<template>
	<view class="container">
		<block v-if="isload">
			<form @submit="getTmplIds">
				<view v-if="needaddress == 0" class="address-add">
					<view class="linkitem">
						<text class="f1">联 系 人：</text>
						<input type="text" class="input" :value="linkman" placeholder="请输入您的姓名" @input="inputLinkman"
							placeholder-style="color:#626262;font-size:28rpx" />
					</view>
					<view class="linkitem">
						<text class="f1">联系电话：</text>
						<input type="text" class="input" :value="tel" placeholder="请输入您的手机号" @input="inputTel"
							placeholder-style="color:#626262;font-size:28rpx" />
					</view>
				</view>
				<view v-else class="address-add flex-y-center" @tap="goto"
					:data-url="'/pages/address/' + (address.id ? 'address' : 'addressadd') + '?fromPage=buy&type=' + (havetongcheng == 1 ? '1' : '0')">
					<view class="f1">
						<image class="img" :src="static_url + '/static/img/address.png'" />
					</view>
					<view class="f2 flex1" v-if="address.id">
						<view style="font-weight:bold;color:#111111;font-size:30rpx">{{ address.name }}
							{{ address.tel }}
							<text v-if="address.company">{{ address.company }}</text>
						</view>
						<view style="font-size:24rpx">{{ address.area }} {{ address.address }}</view>
					</view>
					<view v-else class="f2 flex1">请选择收货地址</view>
					<image src="/static/img/arrowright.png" class="f3"></image>
				</view>
				<view v-for="(buydata, index) in allbuydata" :key="index" class="buydata">
					<view class="btitle">
						<image class="img" src="/static/img/ico-shop.png" />{{ buydata.business.name }}
					</view>
					<view class="bcontent">
						<view class="product">
							<view v-for="(item, index2) in buydata.prodata" :key="index2">
								<view class="item flex">
									<view class="img" @tap="goto"
										:data-url="'/pages/shop/product?id=' + item.product.id">
										<image v-if="item.guige.pic" :src="item.guige.pic"></image>
										<image v-else :src="item.product.pic"></image>
									</view>
									<view class="info flex1">
										<view class="f1">{{ item.product.name }}</view>
										<view class="f2">规格：{{ item.guige.name }}</view>
										<view class="f3">
											<block v-if="order_change_price"><input type="number"
													:value="item.guige.sell_price" :data-price="item.guige.sell_price"
													:data-index="index" :data-index2="index2" class="inputPrice"
													@input="inputPrice"></block>
											<block v-else><text style="font-weight:bold;">￥{{ item.guige.sell_price
											}}</text>
											</block>
											<text style="padding-left:20rpx"> × {{ item.num }}</text>
										</view>
									</view>
								</view>
								<view class="glassinfo" v-if="item.product.product_type == 1" @tap="showglass"
									:data-index="index" :data-index2="index2"
									:data-grid="item.product.has_glassrecord == 1 ? item.product.glassrecord.id : 0"
									:style="'background:rgba(' + t('color1rgb') + ',0.8);color:#FFF'">
									<view class="f1">
										视力档案
									</view>
									<view class="f2">
										<text>{{ item.product.has_glassrecord == 1 ? item.product.glassrecord.name : ''
										}}</text>
										<image src="../../static/img/arrowright.png">
									</view>
								</view>
							</view>
						</view>
						<view class="freight">
							<view class="f1">配送方式</view>
							<view class="freight-ul">
								<view class="flex" style="width:100%;overflow-y:hidden;overflow-x:scroll;">
									<block v-for="(item, idx2) in buydata.freightList" :key="idx2">
										<view class="freight-li"
											:style="buydata.freightkey == idx2 ? 'color:' + t('color1') + ';background:rgba(' + t('color1rgb') + ',0.2)' : ''"
											@tap="changeFreight" :data-bid="buydata.bid" :data-index="idx2">
											{{ item.name }}
										</view>
									</block>
								</view>
							</view>
							<view class="freighttips"
								v-if="buydata.freightList[buydata.freightkey].minpriceset == 1 && buydata.freightList[buydata.freightkey].minprice > 0 && buydata.freightList[buydata.freightkey].minprice * 1 > buydata.product_price * 1">
								满{{ buydata.freightList[buydata.freightkey].minprice }}元起送，还差{{
									(buydata.freightList[buydata.freightkey].minprice
										- buydata.product_price).toFixed(2) }}元
							</view>
							<view class="freighttips" v-if="buydata.freightList[buydata.freightkey].isoutjuli == 1">
								超出配送范围
							</view>
						</view>

						<view class="price" v-if="buydata.freightList[buydata.freightkey].pstimeset == 1">
							<view class="f1">{{ buydata.freightList[buydata.freightkey].pstype == 1 ? '取货' : '配送' }}时间
							</view>
							<view class="f2" @tap="choosePstime" :data-bid="buydata.bid">
								{{ buydata.pstimetext == '' ? '请选择时间' : buydata.pstimetext }}<text
									class="iconfont iconjiantou" style="color:#999;font-weight:normal"></text>
							</view>
						</view>
						<view class="storeitem"
							v-if="buydata.freightList[buydata.freightkey].pstype == 1 && buydata.freightList[buydata.freightkey].isbusiness != 1">
							<view class="panel">
								<view class="f1">取货地点</view>
								<view class="f2" @tap="openMendian" :data-bid="buydata.bid"
									:data-freightkey="buydata.freightkey"
									:data-storekey="buydata.freightList[buydata.freightkey].storekey"><text
										class="iconfont icondingwei"></text>{{
											buydata.freightList[buydata.freightkey].storedata[buydata.freightList[buydata.freightkey].storekey].name
										}}
								</view>
							</view>
							<block v-for="(item, idx) in buydata.freightList[buydata.freightkey].storedata" :key="idx">
								<view class="radio-item" @tap.stop="choosestore" :data-bid="buydata.bid"
									:data-index="idx" v-if="idx < 5 || storeshowall == true">
									<view class="f1">
										<view>{{ item.name }}</view>
										<view v-if="item.address" class="flex-y-center"
											style="font-size:24rpx;color:#aaaaae;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp:1;overflow: hidden;">
											{{ item.address }}
										</view>
									</view>
									<text style="color:#f50;">{{ item.juli }}</text>
									<view class="radio"
										:style="buydata.freightList[buydata.freightkey].storekey == idx ? 'background:' + t('color1') + ';border:0' : ''">
										<image class="radio-img" src="/static/img/checkd.png" />
									</view>
								</view>
							</block>
							<view
								v-if="storeshowall == false && (buydata.freightList[buydata.freightkey].storedata).length > 5"
								class="storeviewmore" @tap="doStoreShowAll">- 查看更多 - </view>
						</view>
						<view class="storeitem"
							v-if="buydata.freightList[buydata.freightkey].pstype == 1 && buydata.freightList[buydata.freightkey].isbusiness == 1">
							<view class="panel">
								<view class="f1">取货地点</view>
							</view>
							<block v-for="(item, idx) in buydata.freightList[buydata.freightkey].storedata" :key="idx">
								<view class="radio-item" v-if="idx < 5 || storeshowall == true" @tap="openLocation"
									:data-freightkey="buydata.freightkey" :data-storekey="idx" :data-bid="buydata.bid"
									:data-index="idx">
									<view class="f1">
										<view>{{ item.name }}</view>
										<view v-if="item.address" class="flex-y-center"
											style="font-size:24rpx;color:#aaaaae;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp:1;overflow: hidden;">
											{{ item.address }}
										</view>
									</view>
									<text style="color:#f50;">{{ item.juli }}</text>
								</view>
							</block>
							<view
								v-if="storeshowall == false && (buydata.freightList[buydata.freightkey].storedata).length > 5"
								class="storeviewmore" @tap="doStoreShowAll">- 查看更多 - </view>
						</view>

						<view class="storeitem" v-if="buydata.freightList[buydata.freightkey].pstype == 5">
							<view class="panel">
								<view class="f1">配送门店</view>
								<view class="f2" @tap="openMendian" :data-bid="buydata.bid"
									:data-freightkey="buydata.freightkey"
									:data-storekey="buydata.freightList[buydata.freightkey].storekey"><text
										class="iconfont icondingwei"></text>{{
											buydata.freightList[buydata.freightkey].storedata[buydata.freightList[buydata.freightkey].storekey].name
										}}
								</view>
							</view>
							<block v-for="(item, idx) in buydata.freightList[buydata.freightkey].storedata" :key="idx">
								<view class="radio-item" @tap.stop="choosestore" :data-bid="buydata.bid"
									:data-index="idx" v-if="idx < 5 || storeshowall == true">
									<view class="f1">
										<view>{{ item.name }}</view>
										<view v-if="item.address"
											style="font-size:24rpx;color:#aaaaae;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp:1;overflow: hidden;">
											{{ item.address }}
										</view>
									</view>
									<text style="color:#f50;">{{ item.juli }}</text>
									<view class="radio"
										:style="buydata.freightList[buydata.freightkey].storekey == idx ? 'background:' + t('color1') + ';border:0' : ''">
										<image class="radio-img" src="/static/img/checkd.png" />
									</view>
								</view>
							</block>
							<view
								v-if="storeshowall == false && (buydata.freightList[buydata.freightkey].storedata).length > 5"
								class="storeviewmore" @tap="doStoreShowAll">- 查看更多 - </view>
						</view>

						<view class="price" v-if="buydata.freightList[buydata.freightkey].pstype == 11">
							<view class="f1">选择物流</view>
							<view class="f2" @tap="showType11List" :data-bid="buydata.bid">
								<text>{{ buydata.type11key ?
									buydata.freightList[buydata.freightkey].type11pricedata[buydata.type11key - 1].name
									: '请选择' }}</text><text class="iconfont iconjiantou" style="color:#999;font-weight:normal"></text>
							</view>
						</view>

						<view class="price">
							<text class="f1">商品金额</text>
							<text class="f2">¥{{ buydata.product_price }}</text>
						</view>
						<view class="coupon-box">
							<text class="f1">优惠券</text>
							<view class="conpou-right" @tap="openPopup">
								<view class="f2" :class="{ 'f2-col': couponBoxData.price }">
									{{ couponBoxData.price ? `-￥${couponBoxData.price}` : couponDefaultText }}
								</view>
								<text class="iconfont iconjiantou" style="color:#999;font-weight:normal"></text>
							</view>
						</view>
						<!--({{ userinfo.discount }}折)-->
						<view class="price" v-if="buydata.leveldk_money > 0">
							<text class="f1">{{ t('会员') }}折扣</text>
							<text class="f2">-¥{{ buydata.leveldk_money }}</text>
						</view>
						<view class="price" v-if="buydata.manjian_money > 0">
							<text class="f1">满减活动</text>
							<text class="f2">-¥{{ buydata.manjian_money }}</text>
						</view>
						<view class="price">
							<text class="f1">{{ buydata.freightList[buydata.freightkey].freight_price_txt || '运费'
							}}<text v-if="buydata.freightList[buydata.freightkey].pstype != 1 && buydata.freightList[buydata.freightkey].freeset == 1"
									style="color:#aaa;font-size:24rpx;">（满{{
										buydata.freightList[buydata.freightkey].free_price }}元包邮）</text></text>
							<text class="f2">+¥{{ buydata.freightList[buydata.freightkey].freight_price }}</text>
						</view>
						<!--<view class="price">
							<view class="f1">{{t('优惠券')}}</view>
							<view v-if="buydata.couponCount > 0" class="f2" @tap="showCouponList" :data-bid="buydata.bid">
								<block v-if="(buydata.coupons).length>0">
									<text class="couponname" :style="{background:t('color1')}" v-for="(item,index) in buydata.coupons">{{item.couponname}}</text>
								</block>
								<block v-else>
									<text class="couponname" :style="{background:t('color1')}">{{buydata.couponCount+'张可用'}}</text>
								</block>
								<text class="iconfont iconjiantou" style="color:#999;font-weight:normal"></text>
							</view>
							<text class="f2" v-else style="color:#999">无可用{{t('优惠券')}}</text>
						</view>-->
						<view class="price" v-if="buydata.cuxiaoCount > 0">
							<view class="f1">促销活动</view>
							<view class="f2" @tap="showCuxiaoList" :data-bid="buydata.bid">
								<block v-if="buydata.cuxiaonameArr && buydata.cuxiaonameArr.length > 0">
									<view :style="{ background: t('color1') }" class="redBg"
										v-for="(item, index) in buydata.cuxiaonameArr" :key="index">{{ item }}</view>
								</block>
								<block v-else>
									<text :style="{ background: t('color1') }" class="redBg">{{ buydata.cuxiaoname ?
										buydata.cuxiaoname : buydata.cuxiaoCount + '个可用' }}</text>
								</block>
							</view>
							<text class="iconfont iconjiantou" style="color:#999;font-weight:normal"></text>
						</view>
						<view class="price" v-if="buydata.business.invoice > 0">
							<view class="f1">发票</view>
							<view class="f2" @tap="showInvoice"
								:data-url="'/pages/shop/invoice?bid=' + buydata.bid + '&prodata=' + opt.prodata"
								:data-bid="buydata.bid" :data-index="index">
								<text style="font-size:24rpx"
									v-if="buydata.tempInvoice && buydata.tempInvoice.invoice_name">
									<text v-if="buydata.tempInvoice && buydata.tempInvoice.name_type == 1">个人 - </text>
									<text v-if="buydata.tempInvoice && buydata.tempInvoice.name_type == 2">公司 - </text>
									{{ buydata.tempInvoice.invoice_name }}</text><text class="iconfont iconjiantou"
									style="color:#999;font-weight:normal"></text>
							</view>
						</view>
						<view class="price"
							v-if="buydata.business.invoice > 0 && buydata.business.invoice_rate > 0 && buydata.tempInvoice && buydata.tempInvoice.invoice_name">
							<text class="f1">发票费用</text>
							<text class="f2">¥{{ buydata.invoice_price }}</text>
						</view>

						<view class="price"
							v-if="business_selfscore == 1 && scoredkdataArr[buydata.bid].score2money > 0 && (scoredkdataArr[buydata.bid].scoremaxtype == 0 || (scoredkdataArr[buydata.bid].scoremaxtype == 1 && scoredkdataArr[buydata.bid].scoredkmaxmoney > 0))">
							<checkbox-group @change="scoredk2" :data-bid="buydata.bid" class="flex" style="width:100%">
								<view class="f1">
									<view>{{ scoredkdataArr[buydata.bid].score * 1 }} {{ t('积分') }}可抵扣 <text
											style="color:#e94745">{{ scoredkdataArr[buydata.bid].scoredk_money * 1
											}}</text>
										元</view>
									<view style="font-size:22rpx;color:#999"
										v-if="scoredkdataArr[buydata.bid].scoremaxtype == 0 && scoredkdataArr[buydata.bid].scoredkmaxpercent > 0 && scoredkdataArr[buydata.bid].scoredkmaxpercent < 100">
										最多可抵扣订单金额的{{ scoredkdataArr[buydata.bid].scoredkmaxpercent }}%</view>
									<view style="font-size:22rpx;color:#999"
										v-else-if="scoredkdataArr[buydata.bid].scoremaxtype == 1">
										最多可抵扣{{ scoredkdataArr[buydata.bid].scoredkmaxmoney }}元</view>
								</view>
								<view class="f2" style="font-weight:normal">使用{{ t('积分') }}抵扣
									<checkbox value="1" style="margin-left:6px;transform:scale(.8)"></checkbox>
								</view>
							</checkbox-group>
						</view>

						<!-- <view class="price" v-if="moneydec &&shop_num>1 && userinfo.money>0 && buydata.money_dec_rate>0 ">
                        	<checkbox-group @change="moneydk" :data-bid="buydata.bid" :data-rate="buydata.money_dec_rate" class="flex" style="width:100%">
                        		<view class="f1">
                        			<view>
                                        {{t('余额')}}抵扣（余额：<text style="color:#e94745">{{userinfo.money}}</text>元）
                                    </view>
                                    <view style="font-size:24rpx;color:#999;display: none;" >
                                    	1、选择此项提交订单时将直接扣除{{t('余额')}}
                                    </view>
                        			<view style="font-size:24rpx;color:#999;display: none;" >
                        				2、最多可抵扣订单金额的{{buydata.money_dec_rate}}%
                                    </view>
                        		</view>
                        		<view class="f2" style="font-weight:normal">
                                    使用{{t('余额')}}抵扣
                        			<checkbox value="1" style="margin-left:6px;transform:scale(.8)"></checkbox>
                        		</view>
                        	</checkbox-group>
                        </view>-->
						<view style="display:none">{{ test }}</view>
						<view class="form-item" v-for="(item, idx) in buydata.freightList[buydata.freightkey].formdata"
							:key="item.id">
							<view class="label">{{ item.val1 }}<text v-if="item.val3 == 1" style="color:red"> *</text>
							</view>
							<block v-if="item.key == 'input'">
								<input type="text" :name="'form' + buydata.bid + '_' + idx" class="input"
									:placeholder="item.val2" placeholder-style="font-size:28rpx" />
							</block>
							<block v-if="item.key == 'textarea'">
								<textarea :name="'form' + buydata.bid + '_' + idx" class='textarea'
									:placeholder="item.val2" placeholder-style="font-size:28rpx" />
							</block>
							<block v-if="item.key == 'radio'">
								<radio-group class="radio-group" :name="'form' + buydata.bid + '_' + idx">
									<label v-for="(item1, idx1) in item.val2" :key="item1.id" class="flex-y-center">
										<radio class="radio" :value="item1" />{{ item1 }}
									</label>
								</radio-group>
							</block>
							<block v-if="item.key == 'checkbox'">
								<checkbox-group :name="'form' + buydata.bid + '_' + idx" class="checkbox-group">
									<label v-for="(item1, idx1) in item.val2" :key="item1.id" class="flex-y-center">
										<checkbox class="checkbox" :value="item1" />{{ item1 }}
									</label>
								</checkbox-group>
							</block>
							<block v-if="item.key == 'selector'">
								<picker class="picker" mode="selector" :name="'form' + buydata.bid + '_' + idx" value=""
									:range="item.val2" @change="editorBindPickerChange" :data-bid="buydata.bid"
									:data-idx="idx">
									<view v-if="buydata.editorFormdata[idx] || buydata.editorFormdata[idx] === 0">
										{{ item.val2[buydata.editorFormdata[idx]] }}
									</view>
									<view v-else>请选择</view>
								</picker>
								<text class="iconfont iconjiantou" style="color:#999;font-weight:normal"></text>
							</block>
							<block v-if="item.key == 'time'">
								<picker class="picker" mode="time" :name="'form' + buydata.bid + '_' + idx" value=""
									:start="item.val2[0]" :end="item.val2[1]" :range="item.val2"
									@change="editorBindPickerChange" :data-bid="buydata.bid" :data-idx="idx">
									<view v-if="buydata.editorFormdata[idx]">{{ buydata.editorFormdata[idx] }}</view>
									<view v-else>请选择</view>
								</picker>
								<text class="iconfont iconjiantou" style="color:#999;font-weight:normal"></text>
							</block>
							<block v-if="item.key == 'date'">
								<picker class="picker" mode="date" :name="'form' + buydata.bid + '_' + idx" value=""
									:start="item.val2[0]" :end="item.val2[1]" :range="item.val2"
									@change="editorBindPickerChange" :data-bid="buydata.bid" :data-idx="idx">
									<view v-if="buydata.editorFormdata[idx]">{{ buydata.editorFormdata[idx] }}</view>
									<view v-else>请选择</view>
								</picker>
								<text class="iconfont iconjiantou" style="color:#999;font-weight:normal"></text>
							</block>
							<block v-if="item.key == 'upload'">
								<input type="text" style="display:none" :name="'form' + buydata.bid + '_' + idx"
									:value="buydata.editorFormdata[idx]" />
								<view class="flex" style="flex-wrap:wrap;padding-top:20rpx">
									<view class="form-imgbox" v-if="buydata.editorFormdata[idx]">
										<view class="form-imgbox-img">
											<image class="image" :src="buydata.editorFormdata[idx]"
												@click="previewImage" :data-url="buydata.editorFormdata[idx]"
												mode="widthFix" />
										</view>
									</view>
									<view class="form-uploadbtn"
										:style="{ background: 'url(' + static_url + '/static/img/shaitu_icon.png) no-repeat 50rpx', backgroundSize: '80rpx 80rpx', backgroundColor: '#F3F3F3' }"
										@click="editorChooseImage" :data-bid="buydata.bid" :data-idx="idx"></view>
								</view>
							</block>
						</view>
					</view>
				</view>
				<view class="scoredk" v-if="buy_selectmember">
					<view class="price">
						<view class="f1">选择会员</view>
						<view class="f2" @tap="showMemberList">
							<text>{{ checkMem.id ? checkMem.nickname : '请选择' }}</text><text class="iconfont iconjiantou"
								style="color:#999;font-weight:normal"></text>
						</view>
					</view>
				</view>
				<view class="scoredk"
					v-if="business_selfscore == 0 && userinfo.score2money > 0 && (userinfo.scoremaxtype == 0 || (userinfo.scoremaxtype == 1 && userinfo.scoredkmaxmoney > 0))">
					<checkbox-group @change="scoredk" class="flex" style="width:100%">
						<view class="f1">
							<view>{{ userinfo.score * 1 }} {{ t('积分') }}可抵扣 <text style="color:#e94745">{{
								userinfo.scoredk_money * 1 }}</text> 元</view>
							<view style="font-size:22rpx;color:#999"
								v-if="userinfo.scoremaxtype == 0 && userinfo.scoredkmaxpercent > 0 && userinfo.scoredkmaxpercent < 100">
								最多可抵扣订单金额的{{ userinfo.scoredkmaxpercent }}%</view>
							<view style="font-size:22rpx;color:#999" v-else-if="userinfo.scoremaxtype == 1">
								最多可抵扣{{ userinfo.scoredkmaxmoney }}元</view>
						</view>
						<view class="f2">使用{{ t('积分') }}抵扣
							<checkbox value="1" style="margin-left:6px;transform:scale(.8)"></checkbox>
						</view>
					</checkbox-group>
				</view>
				<!--<view class="scoredk" v-if="moneydec && shop_num<=1 && userinfo.money>0 && allbuydata[shop_bid].money_dec_rate>0 ">
                	<checkbox-group @change="moneydk" :data-bid="allbuydata[shop_bid].bid" :data-rate="allbuydata[shop_bid].money_dec_rate" class="flex" style="width:100%">
                		<view class="f1">
                			<view>
                                {{t('余额')}}抵扣（余额：<text style="color:#e94745">{{userinfo.money}}</text>元）
                            </view>
                            <view style="font-size:24rpx;color:#999;display: none;" >
                            	1、选择此项提交订单时将直接扣除{{t('余额')}}
                            </view>
                			<view style="font-size:24rpx;color:#999;display: none;" >
                				2、最多可抵扣订单金额的{{allbuydata[shop_bid].money_dec_rate}}%
                            </view>
                		</view>
                		<view class="f2" >
                            使用{{t('余额')}}抵扣
                			<checkbox value="1" style="margin-left:6px;transform:scale(.8)"></checkbox>
                		</view>
                	</checkbox-group>
                </view>-->
				<view style="width: 100%; height:110rpx;"></view>
				<view class="footer flex notabbarbot">
					<view class="text1 flex1">总计：
						<block v-if="showprice_dollar && usdalltotalprice">
							<text style="font-weight:bold;font-size:36rpx;margin-right: 10rpx;">${{ usdalltotalprice
							}}</text>
							<text style="font-weight:bold;font-size:32rpx">￥{{ finalPrice }}</text>
						</block>
						<block v-else>
							<text style="font-weight:bold;font-size:36rpx">￥{{ finalPrice }}</text>
						</block>
					</view>
					<button class="op" form-type="submit" :style="{ background: '' + t('color2') + '' }"
						:disabled="submitDisabled">
						提交订单</button>
				</view>
			</form>

			<view v-if="invoiceShow" class="popup__container">
				<view class="popup__overlay" @tap.stop="handleClickMask"></view>
				<view class="popup__modal">
					<view class="popup__title">
						<text class="popup__title-text">请填写开票信息</text>
						<image src="/static/img/close.png" class="popup__close" style="width:36rpx;height:36rpx"
							@tap.stop="handleClickMask" />
					</view>
					<view class="popup__content invoiceBox">
						<form @submit="invoiceFormSubmit" @reset="formReset" report-submit="true">
							<view class="orderinfo">
								<view class="item">
									<text class="t1">发票类型</text>
									<view class="t2">
										<radio-group class="radio-group" @change="changeOrderType" name="invoice_type">
											<label class="radio" v-if="inArray(1, invoice_type)">
												<radio value="1" :checked="invoice_type_select == 1 ? true : false">
												</radio>普通发票
											</label>
											<label class="radio" v-if="inArray(2, invoice_type)">
												<radio value="2" :checked="invoice_type_select == 2 ? true : false">
												</radio>增值税专用发票
											</label>
										</radio-group>
									</view>
								</view>
								<view class="item">
									<text class="t1">抬头类型</text>
									<view class="t2">
										<block v-if="inputDisabled">
											<text v-if="invoice && invoice.name_type == 1">个人</text>
											<text v-if="invoice && invoice.name_type == 2">公司</text>
										</block>
										<block v-else>
											<radio-group class="radio-group" @change="changeNameType" name="name_type">
												<label class="radio">
													<radio value="1" :checked="name_type_select == 1 ? true : false"
														:disabled="name_type_personal_disabled ? true : false"></radio>
													个人
												</label>
												<label class="radio">
													<radio value="2" :checked="name_type_select == 2 ? true : false">
													</radio>公司
												</label>
											</radio-group>
										</block>
									</view>
								</view>
								<view class="item">
									<text class="t1">抬头名称</text>
									<input class="t2" type="text" placeholder="抬头名称"
										placeholder-style="font-size:28rpx;color:#BBBBBB" name="invoice_name"
										:disabled="inputDisabled" :value="invoice ? invoice.invoice_name : ''"></input>
								</view>
								<view class="item" v-if="name_type_select == 2">
									<text class="t1">公司税号</text>
									<input class="t2" type="text" placeholder="公司税号"
										placeholder-style="font-size:28rpx;color:#BBBBBB" name="tax_no"
										:disabled="inputDisabled" :value="invoice ? invoice.tax_no : ''"></input>
								</view>
								<view class="item" v-if="invoice_type_select == 2">
									<text class="t1">注册地址</text>
									<input class="t2" type="text" placeholder="注册地址"
										placeholder-style="font-size:28rpx;color:#BBBBBB" name="address"
										:disabled="inputDisabled" :value="invoice ? invoice.address : ''"></input>
								</view>
								<view class="item" v-if="invoice_type_select == 2">
									<text class="t1">注册电话</text>
									<input class="t2" type="text" placeholder="注册电话"
										placeholder-style="font-size:28rpx;color:#BBBBBB" name="tel"
										:disabled="inputDisabled" :value="invoice ? invoice.tel : ''"></input>
								</view>
								<view class="item" v-if="invoice_type_select == 2">
									<text class="t1">开户银行</text>
									<input class="t2" type="text" placeholder="开户银行"
										placeholder-style="font-size:28rpx;color:#BBBBBB" name="bank_name"
										:disabled="inputDisabled" :value="invoice ? invoice.bank_name : ''"></input>
								</view>
								<view class="item" v-if="invoice_type_select == 2">
									<text class="t1">银行账号</text>
									<input class="t2" type="text" placeholder="银行账号"
										placeholder-style="font-size:28rpx;color:#BBBBBB" name="bank_account"
										:disabled="inputDisabled" :value="invoice ? invoice.bank_account : ''"></input>
								</view>
								<view class="item">
									<text class="t1">手机号</text>
									<input class="t2" type="text" placeholder="接收电子发票手机号"
										placeholder-style="font-size:28rpx;color:#BBBBBB" name="mobile"
										:disabled="inputDisabled" :value="invoice ? invoice.mobile : ''"></input>
								</view>
								<view class="item">
									<text class="t1">邮箱</text>
									<input class="t2" type="text" placeholder="接收电子发票邮箱"
										placeholder-style="font-size:28rpx;color:#BBBBBB" name="email"
										:disabled="inputDisabled" :value="invoice ? invoice.email : ''"></input>
								</view>
							</view>
							<button class="btn" form-type="submit" :style="{ background: t('color1') }">确定</button>
							<view style="padding-top:30rpx"></view>
						</form>
					</view>
				</view>
			</view>

			<view v-if="couponvisible" class="popup__container">
				<view class="popup__overlay" @tap.stop="handleClickMask"></view>
				<view class="popup__modal">
					<view class="popup__title">
						<text class="popup__title-text">请选择{{ t('优惠券') }}</text>
						<image src="/static/img/close.png" class="popup__close" style="width:36rpx;height:36rpx"
							@tap.stop="handleClickMask" />
					</view>
					<view class="popup__content card-content">
						<!-- <couponlist :couponlist="allbuydata[bid].couponList" :choosecoupon="true"
							:selectedrids="allbuydata[bid].couponrids" :bid="bid" @chooseCoupon="chooseCoupon">
						</couponlist> -->
						<scroll-view class="popup-lq" scroll-y="true">
							<block v-if="coupon_list.length > 0">
								<view class="card" :style="{ background: t('color2') }"
									v-for="(item, index) in coupon_list" :key="index">
									<view class="card-left">
										<view class="card-left-top" v-if="item.type == 41"
											:style="{ background: `linear-gradient(to right, ${t('color2')}, ${t('color1')})` }">
											新人券
										</view>
										<text class="card-left-money">￥</text>
										<text>{{ item.money }}</text>
									</view>
									<view class="card-item" @tap="selectCoupon(index)">
										<view class="card-right">
											<view class="card-time">
												{{ item.couponname }}
											</view>
											<view class="card-right-text">
												<text class="product-title"
													v-if="item.producttitle != null && item.producttitle !== undefined">
													{{ item.producttitle }}
												</text>
											</view>
											<view class="card-time">
												{{ calculateRemainingTime(item.starttime, item.endtime) }}
											</view>
										</view>
										<view class="card-btn-box">
											<view class="radiobox" @tap.stop="changeradio" :data-index="index">
												<view class="radio"
													:style="item.checked ? 'background:' + t('color1') + ';border:0' : ''">
													<image class="radio-img" src="/static/img/checkd.png" />
												</view>
											</view>
										</view>
									</view>
								</view>
							</block>
							<block v-else>
								<view class="no-coupon">
									<text>暂无可用优惠券</text>
								</view>
							</block>
						</scroll-view>
						<button v-if="coupon_list.length > 0" class="pop-btn" :style="{ background: t('color1') }"
							@tap.stop="confirmBtn">确定</button>

					</view>
				</view>
			</view>
			<view v-if="pstimeDialogShow" class="popup__container">
				<view class="popup__overlay" @tap.stop="hidePstimeDialog"></view>
				<view class="popup__modal">
					<view class="popup__title">
						<text class="popup__title-text">请选择{{
							allbuydata[nowbid].freightList[allbuydata[nowbid].freightkey].pstype == 1 ? '取货' : '配送'
						}}时间</text>
						<image src="/static/img/close.png" class="popup__close" style="width:36rpx;height:36rpx"
							@tap.stop="hidePstimeDialog" />
					</view>
					<view class="popup__content">
						<view class="pstime-item"
							v-for="(item, index) in allbuydata[nowbid].freightList[allbuydata[nowbid].freightkey].pstimeArr"
							:key="index" @tap="pstimeRadioChange" :data-index="index">
							<view class="flex1">{{ item.title }}</view>
							<view class="radio"
								:style="allbuydata[nowbid].freight_time == item.value ? 'background:' + t('color1') + ';border:0' : ''">
								<image class="radio-img" src="/static/img/checkd.png" />
							</view>
						</view>
					</view>
				</view>
			</view>

			<view v-if="cuxiaovisible" class="popup__container">
				<view class="popup__overlay" @tap.stop="handleClickMask"></view>
				<view class="popup__modal">
					<view class="popup__title">
						<text class="popup__title-text">优惠促销</text>
						<image src="/static/img/close.png" class="popup__close" style="width:36rpx;height:36rpx"
							@tap.stop="handleClickMask" />
					</view>
					<view class="popup__content">
						<view class="cuxiao-desc">
							<block v-if="multi_promotion">
								<view class="cuxiao-item" @tap="changecxMulti" data-id="0">
									<view class="type-name"><text style="color:#333">不使用促销</text></view>
									<view class="radio"
										:style="cxid === 0 ? 'background:' + t('color1') + ';border:0' : ''">
										<image class="radio-img" src="/static/img/checkd.png" />
									</view>
								</view>
								<view v-for="(item, index) in allbuydata[bid].cuxiaolist" :key="index"
									class="cuxiao-item" @tap="changecxMulti" :data-id="item.id" :data-index="index">
									<view class="type-name">
										<text
											style="border-radius:4px;border:1px solid #f05423;color: #ff550f;font-size:20rpx;padding:2px 5px">{{
												item.tip }}</text>
										<text style="color:#333;padding-left:20rpx">{{ item.name }}</text>
									</view>
									<view class="radio"
										:style="cxids.indexOf(item.id) !== -1 ? 'background:' + t('color1') + ';border:0' : ''">
										<image class="radio-img" src="/static/img/checkd.png" />
									</view>
								</view>
							</block>
							<block v-else>
								<view class="cuxiao-item" @tap="changecx" data-id="0">
									<view class="type-name"><text style="color:#333">不使用促销</text></view>
									<view class="radio"
										:style="cxid == 0 ? 'background:' + t('color1') + ';border:0' : ''">
										<image class="radio-img" src="/static/img/checkd.png" />
									</view>
								</view>
								<view v-for="(item, index) in allbuydata[bid].cuxiaolist" :key="index"
									class="cuxiao-item" @tap="changecx" :data-id="item.id" :data-index="index">
									<view class="type-name">
										<text
											style="border-radius:4px;border:1px solid #f05423;color: #ff550f;font-size:20rpx;padding:2px 5px">{{
												item.tip }}</text>
										<text style="color:#333;padding-left:20rpx">{{ item.name }}</text>
									</view>
									<view class="radio"
										:style="cxid == item.id ? 'background:' + t('color1') + ';border:0' : ''">
										<image class="radio-img" src="/static/img/checkd.png" />
									</view>
								</view>
							</block>
						</view>
						<view id="cxproinfo" v-if="cuxiaoinfo.product" style="padding:0 40rpx">
							<view class="product">
								<view class="item flex" style="background:#f5f5f5">
									<view class="img" @tap="goto"
										:data-url="'/pages/shop/product?id=' + cuxiaoinfo.product.id">
										<image :src="cuxiaoinfo.product.pic"></image>
									</view>
									<view class="info flex1">
										<view class="f1">{{ cuxiaoinfo.product.name }}</view>
										<view class="f2">规格：{{ cuxiaoinfo.guige.name }}</view>
										<view class="f3">
											<text style="font-weight:bold;">￥{{ cuxiaoinfo.guige.sell_price }}</text>
											<text style="padding-left:20rpx"> × 1</text>
										</view>
									</view>
								</view>
							</view>
						</view>
						<view style="width:100%; height:120rpx;"></view>
						<view style="width:100%;position:absolute;bottom:0;padding:20rpx 5%;background:#fff">
							<view
								style="width:100%;height:80rpx;line-height:80rpx;border-radius:40rpx;text-align:center;color:#fff;"
								:style="{ background: t('color1') }" @tap="chooseCuxiao">确 定</view>
						</view>
					</view>
				</view>
			</view>

			<view v-if="type11visible" class="popup__container">
				<view class="popup__overlay" @tap.stop="handleClickMask"></view>
				<view class="popup__modal">
					<view class="popup__title">
						<text class="popup__title-text">选择物流</text>
						<image src="/static/img/close.png" class="popup__close" style="width:36rpx;height:36rpx"
							@tap.stop="handleClickMask" />
					</view>
					<view class="popup__content">
						<view class="cuxiao-desc">
							<view
								v-for="(item, index) in allbuydata[bid].freightList[allbuydata[bid].freightkey].type11pricedata"
								:key="index" @tap="changetype11" :data-index="index" style="padding:0 30rpx 20rpx 40rpx"
								v-if="address.id && address.province == item.province && address.city == item.city && address.district == item.area">
								<view class="cuxiao-item" style="padding:0">
									<view class="type-name"><text style="color:#333;font-weight:bold;">{{ item.name
									}}</text></view>
									<view class="radio"
										:style="type11key == index ? 'background:' + t('color1') + ';border:0' : ''">
										<image class="radio-img" src="/static/img/checkd.png" />
									</view>
								</view>
								<view style="margin-left:20rpx">发货: {{ item.send_address }} - {{ item.send_tel }}</view>
								<view style="margin-left:20rpx">收货: {{ item.receive_address }} - {{ item.receive_tel }}
								</view>
							</view>
						</view>
						<view style="width:100%; height:120rpx;"></view>
						<view style="width:100%;position:absolute;bottom:0;padding:20rpx 5%;background:#fff">
							<view
								style="width:100%;height:80rpx;line-height:80rpx;border-radius:40rpx;text-align:center;color:#fff;"
								:style="{ background: t('color1') }" @tap="chooseType11">确 定</view>
						</view>
					</view>
				</view>
			</view>

			<view v-if="membervisible" class="popup__container">
				<view class="popup__overlay" @tap.stop="handleClickMask"></view>
				<view class="popup__modal" style="height: 1100rpx;">
					<view class="popup__title">
						<text class="popup__title-text">请选择指定会员</text>
						<image src="/static/img/close.png" class="popup__close" style="width:36rpx;height:36rpx;"
							@tap.stop="handleClickMask" />
					</view>
					<view class="popup__content">
						<view class="member_search">
							<view style="width:130rpx;color:#333;flex-shrink:0">选择地区</view>
							<uni-data-picker :localdata="items" :border="false" :placeholder="regiondata || '请选择省市区'"
								@change="regionchange2" class="flex1" style="overflow:hidden"></uni-data-picker>
							<view class="searchMemberButton" @click="memberSearch" style="flex-shrink:0">检索用户</view>
						</view>
						<view class="memberlist">
							<view v-for="(item2, i) in memberList" :key="i" class="memberitem" @tap="checkMember"
								:data-info="item2">
								<image :src="item2.headimg" @tap.stop="showmemberinfo" :data-mid="item2.id" />
								<view class="flex-col">
									<view class="t1" @tap.stop="showmemberinfo" :data-mid="item2.id">
										{{ item2.nickname }}
									</view>
									<view>{{ item2.province }} {{ item2.city }} {{ item2.area }}</view>
								</view>
								<view class="flex1"></view>
								<view class="radio"
									:style="checkMem.id == item2.id ? 'background:' + t('color1') + ';border:0' : ''">
									<image class="radio-img" src="/static/img/checkd.png" />
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>


			<view v-if="memberinfovisible" class="popup__container">
				<view class="popup__overlay" @tap.stop="memberinfoClickMask"></view>
				<view class="popup__modal" style="height: 1100rpx;">
					<view class="popup__title">
						<text class="popup__title-text">查看资料</text>
						<image src="/static/img/close.png" class="popup__close" style="width:36rpx;height:36rpx;"
							@tap.stop="memberinfoClickMask" />
					</view>
					<view class="popup__content">
						<view class="orderinfo">
							<view class="item" v-for="item in selectmemberinfo" :key="index">
								<text class="t1">{{ item[0] }}</text>
								<view class="t2" v-if="item[2] == 'upload'">
									<image :src="item[1]" style="width:400rpx;height:auto" mode="widthFix"
										@tap="previewImage" :data-url="item[1]" />
								</view>
								<text class="t2" v-else>{{ item[1] }}</text>
							</view>
						</view>
					</view>
				</view>
			</view>

			<uni-popup id="dialogbusinessinfo" ref="dialogbusinessinfo" type="dialog">
				<view class="uni-popup-dialog">
					<view class="uni-dialog-title">
						<text class="uni-dialog-title-text">请再次确认下单门店</text>
					</view>
					<view class="uni-dialog-content">
						<view style="width:100%;text-align:left">
							<view style="font-weight:bold">{{ allbuydata[bid].business.name }}</view>
							<view style="font-size:24rpx;color:#888;padding:4rpx 0">
								{{ allbuydata[bid].business.address }}
							</view>
							<dp-map
								:params="{ bgcolor: '#fff', margin_y: 0, margin_x: 0, padding_x: 0, padding_y: 0, height: '150', latitude: allbuydata[bid].business.latitude, longitude: allbuydata[bid].business.longitude, address: allbuydata[bid].business.name }"></dp-map>
						</view>
					</view>
					<view class="uni-dialog-button-group">
						<view class="uni-dialog-button" @click="businessinfoClose">
							<text class="uni-dialog-button-text">取消</text>
						</view>
						<view class="uni-dialog-button uni-border-left" @click="businessinfoOk">
							<text class="uni-dialog-button-text uni-button-color">确定</text>
						</view>
					</view>
				</view>
			</uni-popup>

		</block>
		<loading v-if="loading"></loading>
		<dp-tabbar :opt="opt"></dp-tabbar>
		<popmsg ref="popmsg"></popmsg>
	</view>
</template>

<script>
	var app = getApp();
	export default {
		data() {
			return {
				opt: {},
				loading: false,
				isload: false,
				menuindex: -1,

				pre_url: app.globalData.pre_url,
				static_url: app.globalData.static_url,
				test: 'test',
				havetongcheng: 0,
				address: [],
				memberList: [],
				checkMem: {},
				usescore: 0,
				scoredk_money: 0,
				totalprice: '0.00',
				couponvisible: false,
				cuxiaovisible: false,
				membervisible: false,
				memberinfovisible: false,
				business_payconfirm: false,
				businessinfoConfirm: false,
				topayparams: {},
				selectmemberinfo: {},
				bid: 0,
				nowbid: 0,
				needaddress: 1,
				linkman: '',
				tel: '',
				userinfo: {},
				pstimeDialogShow: false,
				pstimeIndex: -1,
				manjian_money: 0,
				cxid: 0,
				cxids: [],
				latitude: "",
				longitude: "",
				allbuydata: {},
				allbuydatawww: {},
				alltotalprice: "",
				cuxiaoinfo: false,
				cuxiaoList: {},
				type11visible: false,
				type11key: -1,
				regiondata: '',
				items: [],
				editorFormdata: [],
				buy_selectmember: false,
				multi_promotion: 0,
				storeshowall: false,
				order_change_price: false,
				invoiceShow: false,
				invoice: {},
				invoice_type: [],
				invoice_type_select: 1,
				name_type_select: 1,
				name_type_personal_disabled: false,
				inputDisabled: false,
				submitDisabled: false,
				pstype3needAddress: false,
				isshowglass: false,
				glassrecordlist: [],
				grid: 0,
				curindex: -1,
				curindex2: -1,
				showprice_dollar: false,
				usdrate: 0,
				usdalltotalprice: 0,
				hasglassproduct: 0,
				business_selfscore: 0,
				scoredkdataArr: {},

				moneydec: false,
				shop_num: 0, //bid不同类型
				shop_bid: 0, //最后一个bid
				moneydecArr: {},
				coupon_list: [],

				couponBoxData: { // 传递给 coupon-box 的数据
					price: null, // 默认价格
					record_id: null, // 默认 record_id
				},
				couponDefaultText: '请选择优惠券',
				leveldk_money: 0,
				hasUserCancelledCoupon: false,
			};
		},

		onLoad: function(opt) {
			this.opt = app.getopts(opt);
			this.mendian_id = app.getCache('user_selected_mendianid');
			this.getdata();

			// this.getTmplIds()
		},
		onShow: function(e) {
			if (this.hasglassproduct == 1) {
				this.getglassrecord()
			}
			this.calculatePrice()
		},
		onPullDownRefresh: function() {
			this.getdata();
		},
		computed: {
			finalPrice() {
				let price = parseFloat(this.alltotalprice);
				price = Math.round(price * 100) / 100;
				// 如果订单总金额为 0，直接返回 0.00
				if (price <= 0) {
					return '0.00';
				}

				// 如果有优惠券且优惠券价格有效，减去优惠券价格
				if (this.couponBoxData.price && this.couponBoxData.price > 0) {
					price = price - parseFloat(this.couponBoxData.price);
					if (price < 0) {
						price = 0;
					}
				}

				// 返回保留两位小数的价格（字符串形式）
				return price.toFixed(2);
			}
		},
		methods: {
			selectCoupon(index) {
				this.coupon_list.forEach((item, i) => {
					if (i === index) {
						// 切换当前优惠券的选中状态
						item.checked = !item.checked;
						// 如果当前优惠券已取消选中，则更新状态
						if (!item.checked) {
							this.selectedCoupon = null;
							this.$set(this, 'couponBoxData', {
								price: 0,
								record_id: null,
							});
							// 标记用户已手动取消选择
							this.hasUserCancelledCoupon = true;
						} else {
							// 如果当前优惠券被选中，则更新 selectedCoupon
							this.selectedCoupon = this.coupon_list[index];
						}
					} else {
						// 其他优惠券取消选中
						item.checked = false;
					}
				});
			},
			confirmBtn() {
				if (this.selectedCoupon) {
					// 计算商品原价（未扣除积分、优惠券等）
					let originalTotalPrice = 0;
					for (let k in this.allbuydata) {
						originalTotalPrice += parseFloat(this.allbuydata[k].product_price);
					}

					// 判断是否满足最低购买金额条件（基于商品原价）
					if (originalTotalPrice < this.selectedCoupon.minprice) {
						app.error(`商品金额需大于${this.selectedCoupon.minprice}才能使用此优惠券`);
						return;
					}

					// 判断是否满足最低购买数量条件
					if (this.alltotalnum < this.selectedCoupon.minnum) {
						app.error(`购买数量需大于${this.selectedCoupon.minnum}才能使用此优惠券`);
						return;
					}

					// 将选中的优惠券信息传递到 coupon-box
					this.$set(this, 'couponBoxData', {
						price: this.selectedCoupon.money,
						record_id: this.selectedCoupon.record_id,
					});

					// 关闭弹窗
					this.couponvisible = false;
				} else {
					this.couponvisible = false;
					// app.error('请选择一张优惠券');
				}
			},
			changeradio(event) {
				const index = event.currentTarget.dataset.index;
				this.selectCoupon(index);
			},
			openPopup() {
				var that = this;
				var pro_id = that.opt.prodata.split(',')[0];
				// 重置取消状态，让用户可以重新选择
				  this.hasUserCancelledCoupon = false;
				app.get('coupon/getprocoupon', {
					pro_id: pro_id,
				}, function(res) {
					if (res.code == 200) {
						that.coupon_list = res.record_list.map(item => {
							return {
								...item,
								checked: that.selectedCoupon && item.record_id === that.selectedCoupon
									.record_id,
							};
						});
						that.couponvisible = true;
					} else {
						app.error(res.msg)
					}
				});
			},
			getPorcoupon() {
				var that = this;
				var pro_id = that.opt.prodata.split(',')[0];
				app.get('coupon/getprocoupon', {
					pro_id: pro_id,
				}, function(res) {
					if (res.code == 200) {
						that.coupon_list = res.record_list.map(item => {
							// 只有在第一次加载且用户没有取消过选择时才自动选中
							if (!that.hasUserCancelledCoupon && that.opt.youhui_coupon_id == item
								.couponid) {
								item.checked = true;
								that.selectedCoupon = item;
								that.confirmBtn();
							}
							return {
								...item,
								checked: that.selectedCoupon && item.record_id === that.selectedCoupon
									.record_id,
							};
						});
					} else {
						app.error(res.msg)
					}
				});
			},
			calculateRemainingTime(starttime, endtime) {
				// 转换日期格式为 iOS 支持的格式
				const formatDateForIOS = (dateString) => {
					return dateString.replace(/-/g, '/');
				};

				const now = new Date();
				const startTime = new Date(formatDateForIOS(starttime)); // 转换 starttime
				const endTime = new Date(formatDateForIOS(endtime)); // 转换 endtime

				console.log('时间:', now, startTime, endTime);

				if (now >= startTime && now <= endTime) {
					const timeDiff = endTime - now;
					const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
					const hours = Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
					const minutes = Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60));
					return `仅剩${days}天${hours}小时${minutes}分钟`;
				} else if (now < startTime) {
					return "优惠券尚未生效";
				} else {
					return "优惠券已过期";
				}
			},
			getTmplIds: function(e) {
				var that = this;
				if (that.submitDisabled) return;
				that.submitDisabled = true;
				that.loading = true;
				// #ifdef MP-WEIXIN
				app.get('Wxtmpl/getTmplIds', {
					type: 1
				}, function(res) {
					that.loading = false;

					var tmplIds = res.res;
					console.log(tmplIds);
					if (res.res) {

						wx.requestSubscribeMessage({
							tmplIds: tmplIds,
							complete(res, err) {
								that.submitDisabled = false;
								that.topay(e);

							}
						});

					} else {
						that.submitDisabled = false;
						app.error(res);
						that.topay(e);
					}
				});
				// #endif
				// #ifdef H5
				that.loading = false;
				that.submitDisabled = false;
				that.topay(e);
				// #endif
			},
			getdata: function() {
				var that = this;
				that.loading = true;
				app.get('Shop/buy', {
					prodata: that.opt.prodata,
					mendian_id: that.mendian_id,

				}, function(res) {
					that.loading = false;
					if (res.status == 0) {
						if (res.msg) {
							app.alert(res.msg, function() {
								if (res.url) {
									app.goto(res.url);
								} else {
									app.goback();
								}
							});
						} else if (res.url) {
							app.goto(res.url);
						} else {
							app.alert('您没有权限购买该商品');
						}
						return;
					}
					that.havetongcheng = res.havetongcheng;
					that.address = res.address;
					if (that.address && that.address.latitude) {
						that.latitude = that.address.latitude;
						that.longitude = that.address.longitude;
					}
					that.linkman = res.linkman;
					that.tel = res.tel;
					that.userinfo = res.userinfo;
					that.buy_selectmember = res.buy_selectmember;
					that.order_change_price = res.order_change_price;
					that.pstype3needAddress = res.pstype3needAddress;
					if (that.buy_selectmember) {
						uni.request({
							url: app.globalData.static_url + '/static/area2.json',
							data: {},
							method: 'GET',
							header: {
								'content-type': 'application/json'
							},
							success: function(res2) {
								that.items = res2.data
							}
						})
					}
					that.allbuydata = res.allbuydata;
					that.bid = res.bid;
					that.business_payconfirm = res.business_payconfirm || false;
					that.allbuydatawww = JSON.parse(JSON.stringify(res.allbuydata));
					that.needLocation = res.needLocation;
					that.scorebdkyf = res.scorebdkyf;
					that.multi_promotion = res.multi_promotion;
					that.showprice_dollar = res.price_dollar
					that.usdrate = res.usdrate
					that.hasglassproduct = res.hasglassproduct
					that.business_selfscore = res.business_selfscore || 0;
					that.scoredkdataArr = res.scoredkdataArr || {};
					if (res.moneydec) {
						that.moneydec = res.moneydec;
						var shop_num = 0;
						var shop_bid = 0;
						//获取对象数量
						for (var key in res.allbuydata) {
							console.log(key);
							shop_num++
							shop_bid = key;
						}
						that.shop_num = shop_num;
						that.shop_bid = shop_bid;

					}
					that.calculatePrice();
					that.loaded();


					//自动使用余额抵扣

					// var allbuydata = that.allbuydata;
					// for (var i in allbuydata) {
					// 	allbuydata[i].tempInvoice = uni.getStorageSync('temp_invoice_' + allbuydata[i].bid);
					// }
					// that.allbuydata = allbuydata;


					if (res.needLocation == 1) {
						app.getLocation(function(res) {
							var latitude = res.latitude;
							var longitude = res.longitude;
							that.latitude = latitude;
							that.longitude = longitude;
							var allbuydata = that.allbuydata;
							for (var i in allbuydata) {
								var freightList = allbuydata[i].freightList;
								for (var j in freightList) {
									if (freightList[j].pstype == 1 || freightList[j].pstype == 5) {
										var storedata = freightList[j].storedata;
										if (storedata) {
											for (var x in storedata) {
												if (latitude && longitude && storedata[x].latitude &&
													storedata[x].longitude) {
													var juli = that.getDistance(latitude, longitude,
														storedata[x].latitude, storedata[x]
														.longitude);
													storedata[x].juli = juli;
												}
											}
											storedata.sort(function(a, b) {
												return a["juli"] - b["juli"];
											});
											for (var x in storedata) {
												if (storedata[x].juli) {
													storedata[x].juli = storedata[x].juli + '千米';
												}
											}
											allbuydata[i].freightList[j].storedata = storedata;
										}
									}
								}
							}
							that.allbuydata = allbuydata;
						});
					}
				});
			},
			//积分抵扣
			scoredk: function(e) {
				var usescore = e.detail.value[0];
				if (!usescore) usescore = 0;
				this.usescore = usescore;
				this.calculatePrice();
			},
			scoredk2: function(e) {
				var usescore = e.detail.value[0];
				if (!usescore) usescore = 0;
				var thisbid = e.currentTarget.dataset.bid;
				this.scoredkdataArr[thisbid].usescore = usescore;
				//this.test = Math.random();
				this.calculatePrice();
			},
			inputLinkman: function(e) {
				this.linkman = e.detail.value;
			},
			inputTel: function(e) {
				this.tel = e.detail.value;
			},
			inputfield: function(e) {
				var bid = e.currentTarget.dataset.bid;
				var field = e.currentTarget.dataset.field;
				allbuydata2[bid][field] = e.detail.value;
				this.allbuydata2 = allbuydata2;
			},
			//选择收货地址
			chooseAddress: function() {
				app.goto('/pages/address/address?fromPage=buy&type=' + (this.havetongcheng == 1 ? '1' : '0'));
			},
			inputPrice: function(e) {
				var that = this;
				var index = e.currentTarget.dataset.index;
				var index2 = e.currentTarget.dataset.index2;
				var allbuydata = that.allbuydata;
				var allbuydatawww = that.allbuydatawww;
				var oldprice = allbuydatawww[index]['prodata'][index2].guige.sell_price;
				if (e.detail.value == '' || parseFloat(e.detail.value) < parseFloat(oldprice)) {
					that.submitDisabled = true;
					app.error('不能小于原价:' + oldprice);
					return;
				}
				that.submitDisabled = false;
				allbuydata[index]['prodata'][index2].guige.sell_price = e.detail.value;
				allbuydata[index]['product_price'] = (e.detail.value * allbuydata[index]['prodata'][index2].num)
					.toFixed(2);
				// allbuydata[index].prodatastr = allbuydata[index].prodatastr
				that.allbuydata = allbuydata;
				that.calculatePrice();
			},
			//计算价格
			calculatePrice: function() {
				var that = this;
				var address = that.address;
				var allbuydata = that.allbuydata;
				var alltotalprice = 0;
				var allfreight_price = 0;
				var needaddress = 0;
				// console.log(allbuydata)
				for (var k in allbuydata) {


					if (that.moneydec && that.userinfo.money > 0 && allbuydata[k].money_dec_rate > 0) {
						that.moneydk2(allbuydata[k].bid, allbuydata[k].money_dec_rate)
					}


					var product_price = parseFloat(allbuydata[k].product_price);
					var leveldk_money = parseFloat(allbuydata[k].leveldk_money); //会员折扣
					// var leveldk_money = 0;
					// that.userinfo.discount = that.userinfo.discount * 10
					// if (that.userinfo.discount > 0 && that.userinfo.discount < 10) {
					// 	leveldk_money = product_price * (1 - that.userinfo.discount * 0.1);
					// 	leveldk_money = leveldk_money.toFixed(2);
					// 	that.leveldk_money += leveldk_money;
					// }
					var manjian_money = parseFloat(allbuydata[k].manjian_money); //满减活动
					var coupon_money = parseFloat(allbuydata[k].coupon_money); //-优惠券抵扣 
					//var cuxiao_money = parseFloat(allbuydata[k].cuxiao_money); //+促销活动 
					var cuxiao_money = 0;
					var invoice_money = parseFloat(allbuydata[k].invoice_money); //+发票
					var scoredk_money = 0;
					//算运费
					var freightdata = allbuydata[k].freightList[allbuydata[k].freightkey];
					var freight_price = freightdata['freight_price'];
					if (freightdata.pstype != 1 && freightdata.pstype != 3 && freightdata.pstype != 4) {
						needaddress = 1;
					}
					if (that.pstype3needAddress && (freightdata.pstype == 3 || freightdata.pstype == 4 || freightdata
							.pstype == 5)) {
						needaddress = 1;
					}
					if (allbuydata[k].coupontype == 4) {
						freight_price = 0;
					}
					var totalprice = product_price - leveldk_money - manjian_money - coupon_money + cuxiao_money;
					if (totalprice < 0) totalprice = 0; //优惠券不抵扣运费

					totalprice = totalprice + freight_price;
					allbuydata[k].freight_price = freight_price.toFixed(2);
					if (allbuydata[k].business.invoice && allbuydata[k].business.invoice_rate > 0 && allbuydata[k]
						.tempInvoice) {
						var invoice_money = totalprice * parseFloat(allbuydata[k].business.invoice_rate) / 100;
						allbuydata[k].invoice_money = invoice_money.toFixed(2);
						totalprice = totalprice + invoice_money;
					}
					//console.log('invoice_money');
					//console.log(invoice_money);
					if (that.business_selfscore == 1 && that.scoredkdataArr[k].usescore == 1) {
						var scoredkdata = that.scoredkdataArr[k];
						var oldtotalprice = totalprice;
						scoredk_money = parseFloat(scoredkdata.scoredk_money);
						if (scoredkdata.scorebdkyf == '1' && scoredk_money > 0 && totalprice < freight_price) {
							totalprice = freight_price;
							scoredk_money = totalprice - freight_price;
						}
						var scoredkmaxpercent = parseFloat(scoredkdata.scoredkmaxpercent); //最大抵扣比例
						var scoremaxtype = parseInt(scoredkdata.scoremaxtype);
						var scoredkmaxmoney = parseFloat(scoredkdata.scoredkmaxmoney);
						if (scoremaxtype == 0 && scoredk_money > 0 && scoredkmaxpercent > 0 && scoredkmaxpercent <
							100 &&
							scoredk_money > oldtotalprice * scoredkmaxpercent * 0.01) {
							scoredk_money = oldtotalprice * scoredkmaxpercent * 0.01;
							totalprice = oldtotalprice - scoredk_money;
						} else if (scoremaxtype == 1 && scoredk_money > scoredkmaxmoney) {
							scoredk_money = scoredkmaxmoney;
							totalprice = oldtotalprice - scoredk_money;
						}
					}
					totalprice = totalprice - scoredk_money;

					if (totalprice < 0) totalprice = 0;
					allbuydata[k].totalprice = totalprice.toFixed(2);
					alltotalprice += totalprice;
					allfreight_price += freight_price;
				}
				that.needaddress = needaddress;
				if (that.business_selfscore == 0 && that.usescore) {
					var scoredk_money = parseFloat(that.userinfo.scoredk_money); //-积分抵扣
				} else {
					var scoredk_money = 0;
				}

				var oldalltotalprice = alltotalprice;
				alltotalprice = alltotalprice - scoredk_money;
				if (alltotalprice < 0) alltotalprice = 0;

				if (that.scorebdkyf == '1' && scoredk_money > 0 && alltotalprice < allfreight_price) {
					//积分不抵扣运费
					alltotalprice = allfreight_price;
					scoredk_money = oldalltotalprice - allfreight_price;
				}
				var scoredkmaxpercent = parseFloat(that.userinfo.scoredkmaxpercent); //最大抵扣比例
				var scoremaxtype = parseInt(that.userinfo.scoremaxtype);
				var scoredkmaxmoney = parseFloat(that.userinfo.scoredkmaxmoney);

				if (scoremaxtype == 0 && scoredk_money > 0 && scoredkmaxpercent > 0 && scoredkmaxpercent < 100 &&
					scoredk_money > oldalltotalprice * scoredkmaxpercent * 0.01) {
					scoredk_money = oldalltotalprice * scoredkmaxpercent * 0.01;
					alltotalprice = oldalltotalprice - scoredk_money;
				} else if (scoremaxtype == 1 && scoredk_money > scoredkmaxmoney) {
					scoredk_money = scoredkmaxmoney;
					alltotalprice = oldalltotalprice - scoredk_money;
				}


				if (that.moneydec) {
					var moneydecArr = that.moneydecArr;
					for (var k in allbuydata) {
						console.log(moneydecArr, moneydecArr[k], 8999);
						if (moneydecArr && moneydecArr[k] && moneydecArr[k] > 0) {
							var userinfo = that.userinfo;
							var money = userinfo && userinfo.money ? parseFloat(userinfo.money) : 0;
							var rate = moneydecArr[k];
							if (userinfo && money > 0 && rate > 0) {

								var dec_money = alltotalprice * rate / 100;
								dec_money = dec_money.toFixed(2);
								if (dec_money >= money) {
									dec_money = money;
								}
								alltotalprice -= dec_money;
							}
						}
					}
				}


				if (alltotalprice < 0) alltotalprice = 0;
				alltotalprice = alltotalprice.toFixed(2);
				that.alltotalprice = alltotalprice;
				console.log(that.alltotalprice, '最后的价格');
				if (that.showprice_dollar && that.usdrate) {
					that.usdalltotalprice = (that.alltotalprice / that.usdrate).toFixed(2);
				}

				that.allbuydata = allbuydata;
				if (that.opt.youhui_coupon_id && that.alltotalprice > 0) {
					that.getPorcoupon()
				}
			},
			changeFreight: function(e) {
				var that = this;
				var allbuydata = that.allbuydata;
				var bid = e.currentTarget.dataset.bid;
				var index = e.currentTarget.dataset.index;
				var freightList = allbuydata[bid].freightList;
				if (freightList[index].pstype == 1 && freightList[index].storedata.length < 1) {
					app.error('无可自提门店');
					return;
				}
				if (freightList[index].pstype == 5 && freightList[index].storedata.length < 1) {
					app.error('无可配送门店');
					return;
				}
				allbuydata[bid].freightkey = index;
				that.allbuydata = allbuydata;
				that.calculatePrice();
				that.allbuydata[bid].editorFormdata = [];
			},
			chooseFreight: function(e) {
				var that = this;
				var allbuydata = that.allbuydata;
				var bid = e.currentTarget.dataset.bid;
				// console.log(bid);
				// console.log(allbuydata);
				var freightList = allbuydata[bid].freightList;
				var itemlist = [];

				for (var i = 0; i < freightList.length; i++) {
					itemlist.push(freightList[i].name);
				}

				uni.showActionSheet({
					itemList: itemlist,
					success: function(res) {
						if (res.tapIndex >= 0) {
							allbuydata[bid].freightkey = res.tapIndex;
							that.allbuydata = allbuydata;
							that.calculatePrice();
						}
					}
				});
			},
			choosePstime: function(e) {
				var that = this;
				var allbuydata = that.allbuydata;
				var bid = e.currentTarget.dataset.bid;
				var freightkey = allbuydata[bid].freightkey;
				var freightList = allbuydata[bid].freightList;
				var freight = freightList[freightkey];
				var pstimeArr = freightList[freightkey].pstimeArr;
				var itemlist = [];
				for (var i = 0; i < pstimeArr.length; i++) {
					itemlist.push(pstimeArr[i].title);
				}
				if (itemlist.length == 0) {
					app.alert('当前没有可选' + (freightList[freightkey].pstype == 1 ? '取货' : '配送') + '时间段');
					return;
				}
				that.nowbid = bid;
				that.pstimeDialogShow = true;
				that.pstimeIndex = -1;
			},
			pstimeRadioChange: function(e) {
				var that = this;
				var allbuydata = that.allbuydata;
				var pstimeIndex = e.currentTarget.dataset.index;
				// console.log(pstimeIndex)
				var nowbid = that.nowbid;
				var freightkey = allbuydata[nowbid].freightkey;
				var freightList = allbuydata[nowbid].freightList;
				var freight = freightList[freightkey];
				var pstimeArr = freightList[freightkey].pstimeArr;
				var choosepstime = pstimeArr[pstimeIndex];
				allbuydata[nowbid].pstimetext = choosepstime.title;
				allbuydata[nowbid].freight_time = choosepstime.value;
				that.allbuydata = allbuydata
				that.pstimeDialogShow = false;
			},
			hidePstimeDialog: function() {
				this.pstimeDialogShow = false;
			},
			chooseCoupon: function(e) {
				var allbuydata = this.allbuydata;
				var bid = e.bid;
				var couponrid = e.rid;
				var couponkey = e.key;
				var oldcoupons = allbuydata[bid].coupons;
				var oldcouponrids = allbuydata[bid].couponrids;
				var couponList = allbuydata[bid].couponList;
				if (app.inArray(couponrid, oldcouponrids)) {
					var coupons = [];
					var couponrids = [];
					for (var i in oldcoupons) {
						if (oldcoupons[i].id != couponrid) {
							coupons.push(oldcoupons[i]);
							couponrids.push(oldcoupons[i].id);
						}
					}
				} else {
					coupons = oldcoupons;
					couponrids = oldcouponrids;
					console.log(allbuydata[bid].coupon_peruselimit + '---' + oldcouponrids.length);
					if (allbuydata[bid].coupon_peruselimit > oldcouponrids.length) {
						console.log('xxxx');
						coupons.push(couponList[couponkey]);
						couponrids.push(couponList[couponkey].id);
					} else {
						if (allbuydata[bid].coupon_peruselimit > 1) {
							app.error('最多只能选用' + allbuydata[bid].coupon_peruselimit + '张');
							return;
						} else {
							coupons = [couponList[couponkey]];
							couponrids = [couponrid];
						}
					}
				}
				console.log(coupons);
				console.log(couponrids);
				allbuydata[bid].coupons = coupons;
				allbuydata[bid].couponrids = couponrids;
				var coupon_money = 0;
				var coupontype = 1;
				for (var i in coupons) {
					if (coupons[i]['type'] == 4) {
						coupontype = 4;
					} else if (coupons[i]['type'] == 10) {
						coupon_money += coupons[i]['thistotalprice'] * (100 - coupons[i]['discount']) * 0.01;
					} else {
						coupon_money += coupons[i]['money']
					}
				}
				allbuydata[bid].coupontype = coupontype;
				allbuydata[bid].coupon_money = coupon_money;
				this.allbuydata = allbuydata;
				this.couponvisible = false;
				this.calculatePrice();
			},
			choosestore: function(e) {
				var bid = e.currentTarget.dataset.bid;
				var storekey = e.currentTarget.dataset.index;
				var allbuydata = this.allbuydata;
				var buydata = allbuydata[bid];
				var freightkey = buydata.freightkey
				allbuydata[bid].freightList[freightkey].storekey = storekey
				this.allbuydata = allbuydata;
			},
			//提交并支付
			topay: function(e) {
				var that = this;
				// 防止连击
				if (that.submitDisabled) return;
				that.submitDisabled = true;
				var needaddress = that.needaddress;
				var addressid = this.address.id;
				var checkmemid = this.checkMem.id;
				var linkman = this.linkman;
				var tel = this.tel;
				var usescore = this.usescore;
				var frompage = that.opt.frompage ? that.opt.frompage : '';
				var allbuydata = that.allbuydata;
				var moneydecArr = that.moneydecArr;

				if (needaddress == 0) addressid = 0;

				if (needaddress == 1 && addressid == undefined) {
					that.submitDisabled = false;
					app.error('请选择收货地址');
					return;
				}
				var buydata = [];
				for (var i in allbuydata) {
					var freightkey = allbuydata[i].freightkey;
					if (allbuydata[i].freightList[freightkey].pstimeset == 1 && allbuydata[i].freight_time == '') {
						app.error('请选择' + (allbuydata[i].freightList[freightkey].pstype == 1 ? '取货' : '配送') + '时间');
						that.submitDisabled = false;
						return;
					}
					if (allbuydata[i].freightList[freightkey].pstype == 1 || allbuydata[i].freightList[freightkey]
						.pstype == 5) {
						var storekey = allbuydata[i].freightList[freightkey].storekey;
						var storeid = allbuydata[i].freightList[freightkey].storedata[storekey].id;
					} else {
						var storeid = 0;
					}
					if (allbuydata[i].freightList[freightkey].pstype == 11) {
						var type11key = allbuydata[i].type11key;
						if (type11key == 0 || !type11key) {
							app.error('请选择物流');
							that.submitDisabled = false;
							return;
						}
						type11key = type11key - 1;
					} else {
						var type11key = 0
					}

					var formdata_fields = allbuydata[i].freightList[freightkey].formdata;
					var formdata = e.detail.value;
					var newformdata = {};
					for (var j = 0; j < formdata_fields.length; j++) {
						var thisfield = 'form' + allbuydata[i].bid + '_' + j;
						if (formdata_fields[j].val3 == 1 && (formdata[thisfield] === '' || formdata[thisfield] ===
								undefined || formdata[thisfield].length == 0)) {
							app.alert(formdata_fields[j].val1 + ' 必填');
							that.submitDisabled = false;
							return;
						}
						if (formdata_fields[j].key == 'selector') {
							formdata[thisfield] = formdata_fields[j].val2[formdata[thisfield]]
						}
						if (j > 0 && formdata_fields[j].val1 == '确认账号' && formdata_fields[j - 1].val1 == '充值账号' &&
							formdata[thisfield] != formdata['form' + allbuydata[i].bid + '_' + (j - 1)]) {
							app.alert('两次输入账号不一致');
							that.submitDisabled = false;
							return;
						}
						newformdata['form' + j] = formdata[thisfield];
					}

					// var couponrid = (allbuydata[i].couponrids).join(',');
					var couponrid = that.couponBoxData.record_id;
					var buydatatemp = {
						bid: allbuydata[i].bid,
						prodata: allbuydata[i].prodatastr,
						cuxiaoid: allbuydata[i].cuxiaoid,
						couponrid: couponrid,
						freight_id: allbuydata[i].freightList[freightkey].id,
						freight_time: allbuydata[i].freight_time,
						storeid: storeid,
						formdata: newformdata,
						type11key: type11key,
						moneydec_rate: moneydecArr[i] ? moneydecArr[i] : 0
					};

					if (that.order_change_price) {
						buydatatemp.prodataList = allbuydata[i].prodata;
					}
					if (allbuydata[i].business.invoice) {
						buydatatemp.invoice = allbuydata[i].tempInvoice;
					}
					if (that.business_selfscore == 1) {
						buydatatemp.usescore = that.scoredkdataArr[i].usescore;
					}
					buydata.push(buydatatemp);
				}

				if (that.business_payconfirm && !that.businessinfoConfirm) {
					that.$refs.dialogbusinessinfo.open();
					that.topayparams = e;
					that.submitDisabled = false;
					return;
				}
				// console.log(buydata);return;
				app.showLoading('提交中');
				app.post('Shop/createOrder', {
					frompage: frompage,
					buydata: buydata,
					addressid: addressid,
					linkman: linkman,
					tel: tel,
					checkmemid: checkmemid,
					usescore: usescore,
					latitude: that.latitude,
					longitude: that.longitude,
					pmid: app.globalData.pmid,
					commerce_mid: app.globalData.commerce_mid,
					commerce_type: app.globalData.commerce_type,
				}, function(res) {
					app.globalData.pmid = 0;
					app.globalData.commerce_mid = 0;
					app.globalData.commerce_type = 0;
					app.showLoading(false);
					that.submitDisabled = false;
					if (res.status == 0) {
						//that.showsuccess(res.data.msg);
						app.error(res.msg);
						return;
					}
					if (res.status == 10) {
						uni.showModal({
							title: '提示',
							content: res.msg,
							success: function(ress) {

								if (ress.confirm) {
									// 执行确认后的操作
									app.goto('/pages/pay/pay?id=' + res.payorderid);
								} else {
									// 执行取消后的操作
								}
							}
						})
						return;
					}
					//app.error('订单编号：' +res.payorderid);
					if (res.payorderid)
						app.goto('/pages/pay/pay?id=' + res.payorderid);

				});
			},
			showCouponList: function(e) {
				this.couponvisible = true;
				this.bid = e.currentTarget.dataset.bid;
			},
			showInvoice: function(e) {
				this.invoiceShow = true;
				this.bid = e.currentTarget.dataset.bid;
				let index = e.currentTarget.dataset.index;
				this.invoice_type = this.allbuydata[index].business.invoice_type;
				this.invoice = this.allbuydata[index].tempInvoice;
			},
			changeOrderType: function(e) {
				var that = this;
				var value = e.detail.value;
				if (value == 2) {
					that.name_type_select = 2;
					that.name_type_personal_disabled = true;
				} else {
					that.name_type_personal_disabled = false;
				}
				that.invoice_type_select = value;
			},
			changeNameType: function(e) {
				var that = this;
				var value = e.detail.value;
				that.name_type_select = value;
			},
			invoiceFormSubmit: function(e) {
				var that = this;
				var formdata = e.detail.value;
				if (formdata.invoice_name == '') {
					app.error('请填写抬头名称');
					return;
				}
				if ((formdata.name_type == 2 || formdata.invoice_type == 2) && formdata.tax_no == '') {
					///^[A-Z0-9]{15}$|^[A-Z0-9]{17}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/
					app.error('请填写公司税号');
					return;
				}
				if (formdata.invoice_type == 2) {
					if (formdata.address == '') {
						app.error('请填写注册地址');
						return;
					}
					if (formdata.tel == '') {
						app.error('请填写注册电话');
						return;
					}
					if (formdata.bank_name == '') {
						app.error('请填写开户银行');
						return;
					}
					if (formdata.bank_account == '') {
						app.error('请填写银行账号');
						return;
					}
				}
				if (formdata.mobile != '') {
					if (!/^1[3456789]\d{9}$/.test(formdata.mobile)) {
						app.error("手机号码有误，请重填");
						return;
					}
				}
				if (formdata.email != '') {
					if (!/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(formdata.email)) {
						app.error("邮箱有误，请重填");
						return;
					}
				}
				if (formdata.mobile == '' && formdata.email == '') {
					app.error("手机号和邮箱请填写其中一个");
					return;
				}
				// console.log(formdata);
				var allbuydata = that.allbuydata;
				for (var i in allbuydata) {
					if (allbuydata[i].bid == that.bid)
						allbuydata[i].tempInvoice = formdata;
				}
				that.allbuydata = allbuydata;
				that.invoiceShow = false;
				// that.loading = true;
				// uni.setStorageSync('temp_invoice_' + that.opt.bid, formdata);
				that.calculatePrice();
			},
			handleClickMask: function() {
				let that = this;
				that.couponvisible = false;
				that.cuxiaovisible = false;
				that.type11visible = false;
				that.membervisible = false;
				that.invoiceShow = false;
				if (that.couponBoxData.price == 0 || this.couponBoxData.price == null) {
					that.coupon_list.forEach((item, i) => {
						item.checked = false;
					});
					that.$forceUpdate();
					that.selectedCoupon = null;
					that.$set(that, 'couponBoxData', {
						price: 0, // 清空优惠券价格
						record_id: null, // 清空优惠券 record_id
					});
					that.coupon_money = 0;
				}
			},
			showCuxiaoList: function(e) {
				this.cuxiaovisible = true;
				this.bid = e.currentTarget.dataset.bid;
			},
			changecx: function(e) {
				var that = this;
				var cxid = e.currentTarget.dataset.id;
				var cxindex = e.currentTarget.dataset.index;
				console.log(cxid);
				that.cxid = cxid;
				if (cxid == 0) {
					that.cuxiaoinfo = false;
					return;
				}
				var cuxiaoinfo = that.allbuydata[that.bid].cuxiaolist[cxindex];
				console.log(cuxiaoinfo.cuxiaomoney)
				app.post("Shop/getcuxiaoinfo", {
					id: cxid
				}, function(res) {
					if (cuxiaoinfo.type == 4 || cuxiaoinfo.type == 5) {
						res.cuxiaomoney = cuxiaoinfo.cuxiaomoney
					}
					that.cuxiaoinfo = res;
				});
			},
			changecxMulti: function(e) {
				var that = this;
				var cxid = e.currentTarget.dataset.id;
				var cxindex = e.currentTarget.dataset.index;
				that.cuxiaoList.length = 0;
				console.log('cxid:' + cxid);
				if (cxid == 0) {
					that.cuxiaoinfo = false;
					that.cxids.length = 0;
					that.cxid = 0;
					return;
				}
				var index = that.cxids.indexOf(cxid);
				if (index === -1) {
					that.cxids.push(cxid);
				} else {
					that.cxids.splice(index);
				}
				if (that.cxids.length == 0) {
					that.cxid = 0;
					that.cuxiaoinfo = false;
					return;
				}
				that.cxid = '';
				var cuxiaoinfo = that.allbuydata[that.bid].cuxiaolist[cxindex];
				console.log(cuxiaoinfo.cuxiaomoney)
				app.showLoading();
				app.post("Shop/getcuxiaoinfo", {
					id: that.cxids
				}, function(res) {
					// if (cuxiaoinfo.type == 4 || cuxiaoinfo.type == 5) {
					// 	res.cuxiaomoney = cuxiaoinfo.cuxiaomoney
					// }
					app.showLoading(false);
					that.cuxiaoList = res;
				});
			},
			chooseCuxiao: function() {
				var that = this;
				var allbuydata = that.allbuydata;
				var bid = that.bid;
				var cxid = that.cxid;
				var cxids = that.cxids;
				console.log(cxid == 0)
				if (cxid == 0 || cxid == '') {
					allbuydata[bid].cuxiaoid = '';
					allbuydata[bid].cuxiao_money = 0;
					allbuydata[bid].cuxiaoname = '不使用促销';
					allbuydata[bid].cuxiaonameArr = [];
				} else {
					allbuydata[bid].cuxiaoid = [];
					allbuydata[bid].cuxiao_money = 0;
					allbuydata[bid].cuxiaotype = [];
					allbuydata[bid].cuxiaonameArr = [];
					console.log(that.cuxiaoList.info)
					if (that.cuxiaoList.info && that.cuxiaoList.info.length > 0) {
						for (var i in that.cuxiaoList.info) {
							var cxtype = that.cuxiaoList.info[i].type;
							console.log(cxtype);
							if (cxtype == 1 || cxtype == 6) {
								//满额立减 满件立减
								allbuydata[bid].cuxiao_money += that.cuxiaoList.info[i]['money'] * -1;
							} else if (cxtype == 2) {
								//满额赠送
								allbuydata[bid].cuxiao_money += 0;
							} else if (cxtype == 3) {
								//加价换购  27.8+15.964+41.4
								allbuydata[bid].cuxiao_money += that.cuxiaoList.info[i]['money'];
							} else if (cxtype == 4 || cxtype == 5) {
								//满额打折 满件打折
								var cuxiaoMoney = 0;
								for (var y in that.allbuydata[bid].cuxiaolist) {
									if (that.cuxiaoList.info[i].id == that.allbuydata[bid].cuxiaolist[y].id) {
										cuxiaoMoney = that.allbuydata[bid].cuxiaolist[y].cuxiaomoney;
									}
								}
								console.log('cuxiaoMoney');
								console.log(cuxiaoMoney);
								allbuydata[bid].cuxiao_money += cuxiaoMoney * -1
							}
							allbuydata[bid].cuxiaoid.push(that.cuxiaoList.info[i].id);
							allbuydata[bid].cuxiaotype.push(cxtype);
							allbuydata[bid].cuxiaonameArr.push(that.cuxiaoList.info[i]['name']);
						}
						console.log('allbuydata[bid]');
						console.log(allbuydata[bid]);
					} else {
						var cxtype = that.cuxiaoinfo.info.type;
						console.log(cxtype);
						if (cxtype == 1 || cxtype == 6) {
							//满额立减 满件立减
							allbuydata[bid].cuxiao_money = that.cuxiaoinfo.info['money'] * -1;
						} else if (cxtype == 2) {
							//满额赠送
							allbuydata[bid].cuxiao_money = 0;
						} else if (cxtype == 3) {
							//加价换购  27.8+15.964+41.4
							allbuydata[bid].cuxiao_money = that.cuxiaoinfo.info['money'];
						} else if (cxtype == 4 || cxtype == 5) {
							//var product_price = parseFloat(allbuydata[bid].product_price);
							//var leveldk_money = parseFloat(allbuydata[bid].leveldk_money); //会员折扣
							//var manjian_money = parseFloat(allbuydata[bid].manjian_money); //满减活动
							//满额打折 满件打折
							//allbuydata[bid].cuxiao_money = (1 - that.cuxiaoinfo.info['zhekou'] * 0.1) * (product_price - leveldk_money - manjian_money) * -1;
							allbuydata[bid].cuxiao_money = that.cuxiaoinfo.cuxiaomoney * -1
						}
						allbuydata[bid].cuxiaoid = cxid;
						allbuydata[bid].cuxiaotype = cxtype;
						allbuydata[bid].cuxiaoname = that.cuxiaoinfo.info['name'];
					}
				}
				this.allbuydata = allbuydata;
				this.cuxiaovisible = false;
				this.calculatePrice();
			},
			showType11List: function(e) {
				this.type11visible = true;
				this.bid = e.currentTarget.dataset.bid;
			},
			changetype11: function(e) {
				var that = this;
				var allbuydata = that.allbuydata;
				var bid = that.bid;
				that.type11key = e.currentTarget.dataset.index;
				// console.log(that.type11key)
			},
			chooseType11: function(e) {
				var that = this;
				var allbuydata = that.allbuydata;
				var bid = that.bid;
				var type11key = that.type11key;
				if (type11key == -1) {
					app.error('请选择物流');
					return;
				}
				allbuydata[bid].type11key = type11key + 1;
				// console.log(allbuydata[bid].type11key)
				var freightkey = allbuydata[bid].freightkey;
				var freightList = allbuydata[bid].freightList;
				var freight_price = parseFloat(freightList[freightkey].type11pricedata[type11key].price);
				var product_price = parseFloat(allbuydata[bid].product_price);
				// console.log(freightList[freightkey].freeset);
				// console.log(parseFloat(freightList[freightkey].free_price));
				// console.log(product_price);
				if (freightList[freightkey].freeset == 1 && parseFloat(freightList[freightkey].free_price) <=
					product_price) {
					freight_price = 0;
				}
				allbuydata[bid].freightList[freightkey].freight_price = freight_price;

				this.allbuydata = allbuydata;
				this.type11visible = false;
				this.calculatePrice();
			},
			openMendian: function(e) {
				var allbuydata = this.allbuydata
				var bid = e.currentTarget.dataset.bid;
				var freightkey = e.currentTarget.dataset.freightkey;
				var storekey = e.currentTarget.dataset.storekey;
				var frightinfo = allbuydata[bid].freightList[freightkey]
				var storeinfo = frightinfo.storedata[storekey];
				// console.log(storeinfo)
				app.goto('mendian?id=' + storeinfo.id);
			},
			openLocation: function(e) {
				var allbuydata = this.allbuydata
				var bid = e.currentTarget.dataset.bid;
				var freightkey = e.currentTarget.dataset.freightkey;
				var storekey = e.currentTarget.dataset.storekey;
				var frightinfo = allbuydata[bid].freightList[freightkey]
				var storeinfo = frightinfo.storedata[storekey];
				// console.log(storeinfo)
				var latitude = parseFloat(storeinfo.latitude);
				var longitude = parseFloat(storeinfo.longitude);
				var address = storeinfo.name;
				uni.openLocation({
					latitude: latitude,
					longitude: longitude,
					name: address,
					scale: 13
				})
			},
			editorChooseImage: function(e) {
				var that = this;
				var bid = e.currentTarget.dataset.bid;
				var idx = e.currentTarget.dataset.idx;
				var editorFormdata = that.allbuydata[bid].editorFormdata;
				if (!editorFormdata) editorFormdata = [];
				app.chooseImage(function(data) {
					editorFormdata[idx] = data[0];
					// console.log(editorFormdata)
					that.allbuydata[bid].editorFormdata = editorFormdata
					that.test = Math.random();
				})
			},
			editorBindPickerChange: function(e) {
				var that = this;
				var bid = e.currentTarget.dataset.bid;
				var idx = e.currentTarget.dataset.idx;
				var val = e.detail.value;
				var editorFormdata = that.allbuydata[bid].editorFormdata;
				if (!editorFormdata) editorFormdata = [];
				editorFormdata[idx] = val;
				// console.log(editorFormdata)
				that.allbuydata[bid].editorFormdata = editorFormdata;
				that.test = Math.random();
			},

			showMemberList: function(e) {
				this.membervisible = true;
			},
			regionchange2: function(e) {
				const value = e.detail.value
				// console.log(value[0].text + ',' + value[1].text + ',' + value[2].text);
				this.regiondata = value[0].text + ',' + value[1].text + ',' + value[2].text
			},
			memberSearch: function() {
				var that = this;
				// console.log(that.regiondata)
				app.post('Shop/memberSearch', {
					diqu: that.regiondata
				}, function(res) {
					app.showLoading(false);
					if (res.status == 0) {
						app.error(res.msg);
						return;
					}
					var data = res.memberList;
					that.memberList = data;
				});
			},
			checkMember: function(e) {
				var that = this;
				that.checkMem = e.currentTarget.dataset.info;
				this.membervisible = false;
			},
			showmemberinfo: function(e) {
				var that = this;
				var mid = e.currentTarget.dataset.mid;
				app.showLoading('提交中');
				app.post('Shop/getmemberuplvinfo', {
					mid: mid
				}, function(res) {
					app.showLoading(false);
					if (res.status == 0) {
						app.error(res.msg);
						return;
					}
					that.selectmemberinfo = res.info;
					that.memberinfovisible = true;
				});
			},
			memberinfoClickMask: function() {
				this.memberinfovisible = false;
			},
			businessinfoClose: function() {
				this.$refs.dialogbusinessinfo.close();
			},
			businessinfoOk: function() {
				this.businessinfoConfirm = true;
				this.$refs.dialogbusinessinfo.close();
				this.topay(this.topayparams);
			},
			doStoreShowAll: function() {
				this.storeshowall = true;
			},
			showglass: function(e) {
				var that = this
				var grid = e.currentTarget.dataset.grid;
				var index = e.currentTarget.dataset.index;
				var index2 = e.currentTarget.dataset.index2;
				// console.log(that.glassrecordlist)
				if (that.glassrecordlist.length < 1) {
					//没有数据 就重新请求
					that.getglassrecord();
				} else {
					that.isshowglass = true
				}

				that.curindex = index
				that.curindex2 = index2
				that.grid = grid
			},
			getglassrecord: function(e) {
				var that = this
				if (that.hasglassproduct == 1) {
					that.loading = true;
					app.post('ApiGlass/myrecord', {
						pagenum: 1,
						listrow: 100
					}, function(res) {
						that.loading = false;
						var datalist = res.data;
						that.glassrecordlist = datalist;
						that.isshowglass = true
					});
				}

			},
			hideglass: function(e) {
				var that = this
				that.isshowglass = false;
			},
			chooseglass: function(e) {
				var that = this;
				var gindex = e.detail.value;
				var allbuydata = that.allbuydata;
				var grid = that.grid;
				var index = that.curindex;
				var index2 = that.curindex2;
				console.log(gindex + '-' + that.curindex + '-' + that.curindex2)
				var glassrecordlist = that.glassrecordlist;
				var product = allbuydata[index]['prodata'][index2].product
				var prodata = allbuydata[index]['prodata'];
				var prodataArr = [];
				var sid = glassrecordlist[gindex].id
				for (let i in prodata) {
					var pid = prodata[i].product.id
					var guigeid = prodata[i].guige.id
					var num = prodata[i].num
					var pgrid = 0;
					if (prodata[i].product.has_glassrecord == 1 && prodata[i].product.glassrecord) {
						var pgrid = prodata[i].product.glassrecord.id
					}

					if (index2 == i) {
						if (grid == sid) {
							product.glassrecord = {};
							product.has_glassrecord = 0
							that.grid = 0;
							pgrid = 0
						} else {
							product.glassrecord = glassrecordlist[gindex]
							product.has_glassrecord = 1
							that.grid = glassrecordlist[gindex].id
							pgrid = glassrecordlist[gindex].id
						}
					}
					var pchild = pid + ',' + guigeid + ',' + num + ',' + pgrid;
					prodataArr.push(pchild)
				}
				var prodatastr = prodataArr.join('-');
				that.allbuydata[index]['prodata'][index2]['product'] = product;
				that.allbuydata[index]['prodatastr'] = prodatastr
				console.log(that.allbuydata)
				that.isshowglass = false;
			},
			moneydk: function(e) {
				var that = this;
				var moneydec = that.moneydec;
				if (moneydec) {
					var bid = e.currentTarget.dataset.bid;
					var rate = e.currentTarget.dataset.rate - 0;
					var moneydecArr = that.moneydecArr;
					if (moneydecArr[bid] && moneydecArr[bid] > 0) {
						moneydecArr[bid] = 0;
					} else {
						moneydecArr[bid] = parseFloat(rate);
					}
					that.moneydecArr = moneydecArr;
					console.log(moneydecArr)
					this.calculatePrice();
				}
			},
			moneydk2(bid, rate) {
				var that = this;
				var moneydec = that.moneydec;
				if (moneydec) {
					var bid = bid;
					var rate = rate - 0;
					var moneydecArr = that.moneydecArr;
					if (moneydecArr[bid] && moneydecArr[bid] > 0 && bid != 0) {
						moneydecArr[bid] = 0;
					} else {
						moneydecArr[bid] = parseFloat(rate);
					}
					that.moneydecArr = moneydecArr;
					console.log(moneydecArr)
					//this.calculatePrice();
				}
			},
		}
	}
</script>

<style>
	.redBg {
		color: #fff;
		padding: 4rpx 16rpx;
		font-weight: normal;
		border-radius: 8rpx;
		font-size: 24rpx;
		width: auto;
		display: inline-block;
		margin-top: 4rpx;
	}

	.address-add {
		width: 94%;
		margin: 20rpx 3%;
		background: #fff;
		border-radius: 20rpx;
		padding: 20rpx 3%;
		min-height: 140rpx;
	}

	.address-add .f1 {
		margin-right: 20rpx
	}

	.address-add .f1 .img {
		width: 66rpx;
		height: 66rpx;
	}

	.address-add .f2 {
		color: #666;
	}

	.address-add .f3 {
		width: 26rpx;
		height: 26rpx;
	}

	.linkitem {
		width: 100%;
		padding: 1px 0;
		background: #fff;
		display: flex;
		align-items: center
	}

	.cf3 {
		width: 200rpx;
		height: 26rpx;
		display: block;
		text-align: right;
	}

	.linkitem .f1 {
		width: 160rpx;
		color: #111111
	}

	.linkitem .input {
		height: 50rpx;
		padding-left: 10rpx;
		color: #222222;
		font-weight: bold;
		font-size: 28rpx;
		flex: 1
	}

	.buydata {
		width: 94%;
		margin: 0 3%;
		background: #fff;
		margin-bottom: 20rpx;
		border-radius: 20rpx;
	}

	.btitle {
		width: 100%;
		padding: 20rpx 20rpx;
		display: flex;
		align-items: center;
		color: #111111;
		font-weight: bold;
		font-size: 30rpx
	}

	.btitle .img {
		width: 34rpx;
		height: 34rpx;
		margin-right: 10rpx
	}

	.bcontent {
		width: 100%;
		padding: 0 20rpx
	}

	.product {
		width: 100%;
		border-bottom: 1px solid #f4f4f4
	}

	.product .item {
		width: 100%;
		padding: 20rpx 0;
		background: #fff;
		border-bottom: 1px #ededed dashed;
	}

	.product .item:last-child {
		border: none
	}

	.product .info {
		padding-left: 20rpx;
	}

	.product .info .f1 {
		color: #222222;
		font-weight: bold;
		font-size: 26rpx;
		line-height: 36rpx;
		margin-bottom: 10rpx;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}

	.product .info .f2 {
		color: #999999;
		font-size: 24rpx
	}

	.product .info .f3 {
		color: #FF4C4C;
		font-size: 28rpx;
		display: flex;
		align-items: center;
		margin-top: 10rpx
	}

	.product image {
		width: 140rpx;
		height: 140rpx
	}

	.freight {
		width: 100%;
		padding: 20rpx 0;
		background: #fff;
		display: flex;
		flex-direction: column;
	}

	.freight .f1 {
		color: #333;
		margin-bottom: 10rpx
	}

	.freight .f2 {
		color: #111111;
		text-align: right;
		flex: 1
	}

	.freight .f3 {
		width: 24rpx;
		height: 28rpx;
	}

	.freighttips {
		color: red;
		font-size: 24rpx;
	}

	.freight-ul {
		width: 100%;
		display: flex;
	}

	.freight-li {
		flex-shrink: 0;
		display: flex;
		background: #F5F6F8;
		border-radius: 24rpx;
		color: #6C737F;
		font-size: 24rpx;
		text-align: center;
		height: 48rpx;
		line-height: 48rpx;
		padding: 0 28rpx;
		margin: 12rpx 10rpx 12rpx 0
	}

	.inputPrice {
		border: 1px solid #ddd;
		width: 200rpx;
		height: 40rpx;
		border-radius: 10rpx;
		padding: 0 4rpx;
	}

	.price {
		width: 100%;
		padding: 20rpx 0;
		background: #fff;
		display: flex;
		align-items: center
	}

	.price .f1 {
		color: #333
	}

	.price .f2 {
		color: #111;
		font-weight: bold;
		text-align: right;
		flex: 1
	}

	.price .f3 {
		width: 24rpx;
		height: 24rpx;
	}

	.price .couponname {
		color: #fff;
		padding: 4rpx 16rpx;
		font-weight: normal;
		border-radius: 8rpx;
		font-size: 24rpx;
		display: inline-block;
		margin: 2rpx 0 2rpx 10rpx
	}

	.scoredk {
		width: 94%;
		margin: 0 3%;
		margin-bottom: 20rpx;
		border-radius: 20rpx;
		padding: 24rpx 20rpx;
		background: #fff;
		display: flex;
		align-items: center
	}

	.scoredk .f1 {
		color: #333333
	}

	.scoredk .f2 {
		color: #999999;
		text-align: right;
		flex: 1
	}

	.remark {
		width: 100%;
		padding: 16rpx 0;
		background: #fff;
		display: flex;
		align-items: center
	}

	.remark .f1 {
		color: #333;
		width: 200rpx
	}

	.remark input {
		border: 0px solid #eee;
		height: 70rpx;
		padding-left: 10rpx;
		text-align: right
	}

	.footer {
		width: 96%;
		background: #fff;
		margin-top: 5px;
		position: fixed;
		left: 0px;
		bottom: 0px;
		padding: 0 2%;
		display: flex;
		align-items: center;
		z-index: 8;
		box-sizing: content-box
	}

	.footer .text1 {
		height: 110rpx;
		line-height: 110rpx;
		color: #2a2a2a;
		font-size: 30rpx;
	}

	.footer .text1 text {
		color: #e94745;
		font-size: 32rpx;
	}

	.footer .op {
		width: 200rpx;
		height: 80rpx;
		line-height: 80rpx;
		color: #fff;
		text-align: center;
		font-size: 30rpx;
		border-radius: 44rpx
	}

	.footer .op[disabled] {
		background: #aaa !important;
		color: #666;
	}

	.storeitem {
		width: 100%;
		padding: 20rpx 0;
		display: flex;
		flex-direction: column;
		color: #333
	}

	.storeitem .panel {
		width: 100%;
		height: 60rpx;
		line-height: 60rpx;
		font-size: 28rpx;
		color: #333;
		margin-bottom: 10rpx;
		display: flex
	}

	.storeitem .panel .f1 {
		color: #333
	}

	.storeitem .panel .f2 {
		color: #111;
		font-weight: bold;
		text-align: right;
		flex: 1
	}

	.storeitem .radio-item {
		display: flex;
		width: 100%;
		color: #000;
		align-items: center;
		background: #fff;
		padding: 20rpx 20rpx;
		border-bottom: 1px dotted #f1f1f1
	}

	.storeitem .radio-item:last-child {
		border: 0
	}

	.storeitem .radio-item .f1 {
		color: #333;
		font-size: 30rpx;
		flex: 1
	}

	.storeitem .radio {
		flex-shrink: 0;
		width: 32rpx;
		height: 32rpx;
		background: #FFFFFF;
		border: 2rpx solid #BFBFBF;
		border-radius: 50%;
		margin-left: 30rpx
	}

	.storeitem .radio .radio-img {
		width: 100%;
		height: 100%
	}

	.pstime-item {
		display: flex;
		border-bottom: 1px solid #f5f5f5;
		padding: 20rpx 30rpx;
	}

	.pstime-item .radio {
		flex-shrink: 0;
		width: 32rpx;
		height: 32rpx;
		background: #FFFFFF;
		border: 2rpx solid #BFBFBF;
		border-radius: 50%;
		margin-right: 30rpx
	}

	.pstime-item .radio .radio-img {
		width: 100%;
		height: 100%
	}

	.cuxiao-desc {
		width: 100%
	}

	.cuxiao-item {
		display: flex;
		padding: 0 40rpx 20rpx 40rpx;
	}

	.cuxiao-item .type-name {
		font-size: 28rpx;
		color: #49aa34;
		margin-bottom: 10rpx;
		flex: 1
	}

	.cuxiao-item .radio {
		flex-shrink: 0;
		width: 32rpx;
		height: 32rpx;
		background: #FFFFFF;
		border: 2rpx solid #BFBFBF;
		border-radius: 50%;
		margin-right: 30rpx
	}

	.cuxiao-item .radio .radio-img {
		width: 100%;
		height: 100%
	}

	.form-item {
		width: 100%;
		padding: 16rpx 0;
		background: #fff;
		display: flex;
		align-items: center;
		justify-content: space-between
	}

	.form-item .label {
		color: #333;
		width: 200rpx;
		flex-shrink: 0
	}

	.form-item .radio {
		transform: scale(.7);
	}

	.form-item .checkbox {
		transform: scale(.7);
	}

	.form-item .input {
		border: 0px solid #eee;
		height: 70rpx;
		padding-left: 10rpx;
		text-align: right;
		flex: 1
	}

	.form-item .textarea {
		height: 140rpx;
		line-height: 40rpx;
		overflow: hidden;
		flex: 1;
		border: 1px solid #eee;
		border-radius: 2px;
		padding: 8rpx
	}

	.form-item .radio-group {
		display: flex;
		flex-wrap: wrap;
		justify-content: flex-end
	}

	.form-item .radio {
		height: 70rpx;
		line-height: 70rpx;
		display: flex;
		align-items: center
	}

	.form-item .radio2 {
		display: flex;
		align-items: center;
	}

	.form-item .radio .myradio {
		margin-right: 10rpx;
		display: inline-block;
		border: 1px solid #aaa;
		background: #fff;
		height: 32rpx;
		width: 32rpx;
		border-radius: 50%
	}

	.form-item .checkbox-group {
		display: flex;
		flex-wrap: wrap;
		justify-content: flex-end
	}

	.form-item .checkbox {
		height: 70rpx;
		line-height: 70rpx;
		display: flex;
		align-items: center
	}

	.form-item .checkbox2 {
		display: flex;
		align-items: center;
		height: 40rpx;
		line-height: 40rpx;
	}

	.form-item .checkbox .mycheckbox {
		margin-right: 10rpx;
		display: inline-block;
		border: 1px solid #aaa;
		background: #fff;
		height: 32rpx;
		width: 32rpx;
		border-radius: 2px
	}

	.form-item .picker {
		height: 70rpx;
		line-height: 70rpx;
		flex: 1;
		text-align: right
	}

	.form-imgbox {
		margin-right: 16rpx;
		margin-bottom: 10rpx;
		font-size: 24rpx;
		position: relative;
	}

	.form-imgbox-close {
		position: absolute;
		display: block;
		width: 32rpx;
		height: 32rpx;
		right: -16rpx;
		top: -16rpx;
		color: #999;
		font-size: 32rpx;
		background: #fff
	}

	.form-imgbox-close .image {
		width: 100%;
		height: 100%
	}

	.form-imgbox-img {
		display: block;
		width: 180rpx;
		height: 180rpx;
		padding: 2px;
		border: #d3d3d3 1px solid;
		background-color: #f6f6f6;
		overflow: hidden
	}

	.form-imgbox-img>.image {
		max-width: 100%;
	}

	.form-imgbox-repeat {
		position: absolute;
		display: block;
		width: 32rpx;
		height: 32rpx;
		line-height: 28rpx;
		right: 2px;
		bottom: 2px;
		color: #999;
		font-size: 30rpx;
		background: #fff
	}

	.form-uploadbtn {
		position: relative;
		height: 180rpx;
		width: 180rpx
	}

	.member_search {
		width: 100%;
		padding: 0 40rpx;
		display: flex;
		align-items: center
	}

	.searchMemberButton {
		height: 60rpx;
		background-color: #007AFF;
		border-radius: 10rpx;
		width: 160rpx;
		line-height: 60rpx;
		color: #fff;
		text-align: center;
		font-size: 28rpx;
		display: block;
	}

	.memberlist {
		width: 100%;
		padding: 0 40rpx;
		height: auto;
		margin: 20rpx auto;
	}

	.memberitem {
		display: flex;
		align-items: center;
		border-bottom: 1px solid #f5f5f5;
		padding: 20rpx 0
	}

	.memberitem image {
		display: block;
		height: 100rpx;
		width: 100rpx;
		margin-right: 20rpx;
	}

	.memberitem .t1 {
		color: #333;
		font-weight: bold
	}

	.memberitem .radio {
		flex-shrink: 0;
		width: 32rpx;
		height: 32rpx;
		background: #FFFFFF;
		border: 2rpx solid #BFBFBF;
		border-radius: 50%;
		margin-right: 30rpx
	}

	.memberitem .radio .radio-img {
		width: 100%;
		height: 100%
	}

	.checkMem {
		display: inline-block;
	}

	.checkMem p {
		height: 30px;
		width: 100%;
		display: inline-block;
	}

	.placeholder {
		font-size: 26rpx;
		line-height: 80rpx;
	}

	.selected-item span {
		font-size: 26rpx !important;
	}

	.orderinfo {
		width: 94%;
		margin: 0 3%;
		border-radius: 8rpx;
		margin-top: 16rpx;
		padding: 14rpx 3%;
		background: #FFF;
	}

	.orderinfo .item {
		display: flex;
		width: 100%;
		padding: 20rpx 0;
		border-bottom: 1px dashed #ededed;
		overflow: hidden
	}

	.orderinfo .item:last-child {
		border-bottom: 0;
	}

	.orderinfo .item .t1 {
		width: 200rpx;
		flex-shrink: 0
	}

	.orderinfo .item .t2 {
		flex: 1;
		text-align: right
	}

	.orderinfo .item .red {
		color: red
	}

	.storeviewmore {
		width: 100%;
		text-align: center;
		color: #889;
		height: 40rpx;
		line-height: 40rpx;
		margin-top: 10rpx
	}

	.btn {
		height: 80rpx;
		line-height: 80rpx;
		width: 90%;
		margin: 0 auto;
		border-radius: 40rpx;
		margin-top: 40rpx;
		color: #fff;
		font-size: 28rpx;
		font-weight: bold
	}

	.invoiceBox .radio radio {
		transform: scale(0.8);
	}

	.invoiceBox .radio:nth-child(2) {
		margin-left: 30rpx;
	}

	.glassinfo {
		color: #333;
		padding: 10rpx;
		border-radius: 10rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background: #f4f4f4;
		margin-top: 10rpx;
		font-size: 30rpx;
	}

	.glassinfo .f2 {
		display: flex;
		justify-content: flex-end;
	}

	.glassinfo .f2 image {
		width: 32rpx;
		height: 36rpx;
		padding-top: 4rpx;
	}

	.glassinfo .f1 {
		font-weight: bold;
	}

	.glass_popup .popup__content {
		max-height: 920rpx;
	}

	.glass_popup .gr-add {
		margin-top: 30rpx;
	}

	.glass_popup .gr-add .gr-btn {
		width: 240rpx;
		color: #FFF;
		border-radius: 10rpx;
	}

	.glass_popup .popup__title {
		padding: 30rpx 0 0 0;
	}

	.glassitem {
		background: #f7f7f7;
		border-radius: 10rpx;
		width: 94%;
		margin: 20rpx 3%;
		padding: 20rpx 0;
	}

	.glassitem .fc {
		display: flex;
		align-items: center;
	}

	.glassitem .gremark {
		padding: 0 20rpx;
		padding-left: 100rpx;
		font-size: 24rpx;
		color: #707070;
	}

	.glassitem.on {
		background: #ffe6c8;
	}

	.glassitem .radio {
		width: 80rpx;
		flex-shrink: 0;
		text-align: center;
	}

	.glassitem .gcontent {
		flex: 1;
		padding: 0 20rpx;
	}

	.glassitem .grow {
		line-height: 46rpx;
		color: #545454;
		font-size: 24rpx;
	}

	.glassitem .gtitle {
		font-size: 24rpx;
		color: #222222;
	}

	.glassitem .bt {
		border-top: 1px solid #e3e3e3
	}

	.glassitem .opt {
		width: 80rpx;
		font-size: 26rpx;
		border: 1rpx solid #c5c5c5;
		border-radius: 6rpx;
		height: 50rpx;
		line-height: 50rpx;
		text-align: center;
		margin-right: 16rpx;
	}

	.pdl10 {
		padding-left: 10rpx;
	}

	.uni-popup-dialog {
		width: 300px;
		border-radius: 5px;
		background-color: #fff;
	}

	.uni-dialog-title {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		padding-top: 15px;
		padding-bottom: 5px;
	}

	.uni-dialog-title-text {
		font-size: 16px;
		font-weight: 500;
	}

	.uni-dialog-content {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		align-items: center;
		padding: 5px 15px 15px 15px;
	}

	.uni-dialog-content-text {
		font-size: 14px;
		color: #6e6e6e;
	}

	.uni-dialog-button-group {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		border-top-color: #f5f5f5;
		border-top-style: solid;
		border-top-width: 1px;
	}

	.uni-dialog-button {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex: 1;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		height: 45px;
		/* #ifdef H5 */
		cursor: pointer;
		/* #endif */
	}

	.uni-border-left {
		border-left-color: #f0f0f0;
		border-left-style: solid;
		border-left-width: 1px;
	}

	.uni-dialog-button-text {
		font-size: 14px;
	}

	.uni-button-color {
		color: #007aff;
	}

	.coupon-box {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.conpou-right {
		display: flex;
		align-items: center;

	}

	.conpou-right .f2 {
		color: #999;
	}

	.right-icon {
		width: 40rpx;
		height: 40rpx;
	}

	.card-content {
		padding: 0 20rpx;
	}

	.card {
		display: flex;
		align-items: center;
		width: 100%;

		background: #fff;
		border-radius: 8px;
		-webkit-mask-image: radial-gradient(circle at 88px 4px, transparent 4px, red 4.5px), radial-gradient(closest-side circle at 50%, red 99%, transparent 100%);

		-webkit-mask-repeat: repeat, repeat-y;
		-webkit-mask-position: 0 -8rpx, 170rpx;

		position: relative;
		margin-bottom: 20rpx;
	}

	.card-left {
		width: 88px;
		text-align: center;
		font-size: 18px;
		color: #fff;
		flex-shrink: 0;
	}

	.card-left-top {
		position: absolute;
		top: 0;
		left: 0;
		font-size: 24rpx;
		padding: 4rpx 12rpx;
		border-bottom-right-radius: 30rpx;
	}

	.card-right {
		padding: 16px 12px;
		display: flex;
		// flex: 1;
		flex-direction: column;
	}

	.card-info {
		margin: 0;
		font-size: 14px;
		line-height: 20px;
		color: #fff;
	}

	.card-time {
		font-size: 12px;
		line-height: 16px;
		font-weight: normal;
		color: #fff;
		margin-top: 4px;
	}

	.card-right-text {
		display: flex;
		align-items: center;
		color: #fff;
	}

	.card-right-img {
		width: 30rpx;
		height: 30rpx;
	}

	.card-left-money {
		font-size: 24rpx
	}

	.card-btn-item {
		width: 180rpx;
	}

	.card-btn {
		color: #fff;
		border-radius: 30rpx;
		padding: 10rpx 30rpx;
		font-size: 24rpx;
		text-align: center;

	}

	.product-title {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 240rpx;
	}

	.card-btn-text {
		font-size: 24rpx;
		color: #fff;
		text-align: center;
	}

	.card-item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex: 1;
		padding: 0 20rpx 0 0;
	}

	.card-item::before {
		content: '';
		position: absolute;

		top: 0;
		bottom: 0;
		width: 2px;
		border-left: 1px dashed #fff;

	}

	.radiobox {
		position: absolute;
		right: 0;
		top: 40rpx;
		padding: 20rpx
	}

	.radio {
		flex-shrink: 0;
		width: 32rpx;
		height: 32rpx;
		background: #FFFFFF;
		border: 2rpx solid #BFBFBF;
		border-radius: 50%;
	}

	.radio-img {
		width: 100%;
		height: 100%
	}

	.pop-btn {
		border-radius: 36rpx;
		color: #fff;
	}

	.f2-col {
		color: #ff4c4c;
	}

	.no-coupon {
		display: flex;
		justify-content: center;
		align-items: center;
		height: 200rpx;
		font-size: 28rpx;
		color: #999;
	}

	.popup__content {
		position: relative;
		padding-bottom: 120rpx;
		/* 为确定按钮留出空间 */
		height: 70vh;
		/* 弹框内容区域高度 */
	}

	.popup-lq {
		height: 100%;
		/* 滚动区域高度 */
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.pop-btn {
		position: absolute;
		bottom: 20rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 90%;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		color: #fff;
		font-size: 32rpx;
		border-radius: 40rpx;
		z-index: 1000;
	}
</style>